react-grab 0.1.26 → 0.1.28

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
@@ -1,4 +1,4 @@
1
- import {f}from'./chunk-447CSJVY.js';export{c as DEFAULT_THEME,d as commentPlugin,b as generateSnippet,f as init,e as openPlugin}from'./chunk-447CSJVY.js';export{Aa as formatElementInfo,va as getStack,pa as isInstrumentationActive}from'./chunk-EMBZHHMN.js';/**
1
+ import {f}from'./chunk-XYTXUEOE.js';export{c as DEFAULT_THEME,d as commentPlugin,b as generateSnippet,f as init,e as openPlugin}from'./chunk-XYTXUEOE.js';export{Ba as formatElementInfo,wa as getStack,qa as isInstrumentationActive}from'./chunk-5RMV2HA7.js';/**
2
2
  * @license MIT
3
3
  *
4
4
  * Copyright (c) 2025 Aiden Bai
@@ -6,4 +6,4 @@ import {f}from'./chunk-447CSJVY.js';export{c as DEFAULT_THEME,d as commentPlugin
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=f(),window.__REACT_GRAB__=e),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:e})));export{d as getGlobalApi,c as setGlobalApi};
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=f(),window.__REACT_GRAB__=n),p(n),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:n})));export{l as getGlobalApi,P as registerPlugin,R as setGlobalApi,w as unregisterPlugin};
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkGGMYMQUS_cjs=require('./chunk-GGMYMQUS.cjs');/**
1
+ 'use strict';var chunkQEVSATMF_cjs=require('./chunk-QEVSATMF.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 D=async e=>{let o=await chunkGGMYMQUS_cjs.va(e)??[],x=await chunkGGMYMQUS_cjs.za(e),y=chunkGGMYMQUS_cjs.Ba(e),z=chunkGGMYMQUS_cjs.ya(e),S=chunkGGMYMQUS_cjs.qa(e),k=chunkGGMYMQUS_cjs.Sa(e),v=chunkGGMYMQUS_cjs.Ta(e);return {element:e,htmlPreview:y,stackString:x,stack:o,componentName:z,fiber:S,selector:k,styles:v}},t=new Set,n=false,I=e=>{n=true,t.add(chunkGGMYMQUS_cjs.Da()),t.add(chunkGGMYMQUS_cjs.Fa(e??[document.body])),chunkGGMYMQUS_cjs.Ga(),chunkGGMYMQUS_cjs.Qa();},L=()=>{n=false;for(let e of Array.from(t))e();t.clear(),chunkGGMYMQUS_cjs.Fa([]),chunkGGMYMQUS_cjs.Ha(),chunkGGMYMQUS_cjs.Ra();},M=()=>n,T=async(e,o)=>{await chunkGGMYMQUS_cjs.Ca(e,o);};exports.freeze=I;exports.getElementContext=D;exports.isFreezeActive=M;exports.openFile=T;exports.unfreeze=L;
9
+ var D=async e=>{let o=await chunkQEVSATMF_cjs.wa(e)??[],x=await chunkQEVSATMF_cjs.Aa(e),y=chunkQEVSATMF_cjs.Ca(e),z=chunkQEVSATMF_cjs.za(e),S=chunkQEVSATMF_cjs.ra(e),k=chunkQEVSATMF_cjs.Ta(e),v=chunkQEVSATMF_cjs.Ua(e);return {element:e,htmlPreview:y,stackString:x,stack:o,componentName:z,fiber:S,selector:k,styles:v}},t=new Set,n=false,I=e=>{n=true,t.add(chunkQEVSATMF_cjs.Ea()),t.add(chunkQEVSATMF_cjs.Ga(e??[document.body])),chunkQEVSATMF_cjs.Ha(),chunkQEVSATMF_cjs.Ra();},L=()=>{n=false;for(let e of Array.from(t))e();t.clear(),chunkQEVSATMF_cjs.Ga([]),chunkQEVSATMF_cjs.Ia(),chunkQEVSATMF_cjs.Sa();},M=()=>n,T=async(e,o)=>{await chunkQEVSATMF_cjs.Da(e,o);};exports.freeze=I;exports.getElementContext=D;exports.isFreezeActive=M;exports.openFile=T;exports.unfreeze=L;
@@ -1,4 +1,4 @@
1
- import {va,za,Ba,ya,qa,Sa,Ta,Da,Fa,Ga,Qa,Ha,Ra,Ca}from'./chunk-EMBZHHMN.js';/**
1
+ import {wa,Aa,Ca,za,ra,Ta,Ua,Ea,Ga,Ha,Ra,Ia,Sa,Da}from'./chunk-5RMV2HA7.js';/**
2
2
  * @license MIT
3
3
  *
4
4
  * Copyright (c) 2025 Aiden Bai
@@ -6,4 +6,4 @@ import {va,za,Ba,ya,qa,Sa,Ta,Da,Fa,Ga,Qa,Ha,Ra,Ca}from'./chunk-EMBZHHMN.js';/**
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 D=async e=>{let o=await va(e)??[],x=await za(e),y=Ba(e),z=ya(e),S=qa(e),k=Sa(e),v=Ta(e);return {element:e,htmlPreview:y,stackString:x,stack:o,componentName:z,fiber:S,selector:k,styles:v}},t=new Set,n=false,I=e=>{n=true,t.add(Da()),t.add(Fa(e??[document.body])),Ga(),Qa();},L=()=>{n=false;for(let e of Array.from(t))e();t.clear(),Fa([]),Ha(),Ra();},M=()=>n,T=async(e,o)=>{await Ca(e,o);};export{I as freeze,D as getElementContext,M as isFreezeActive,T as openFile,L as unfreeze};
9
+ var D=async e=>{let o=await wa(e)??[],x=await Aa(e),y=Ca(e),z=za(e),S=ra(e),k=Ta(e),v=Ua(e);return {element:e,htmlPreview:y,stackString:x,stack:o,componentName:z,fiber:S,selector:k,styles:v}},t=new Set,n=false,I=e=>{n=true,t.add(Ea()),t.add(Ga(e??[document.body])),Ha(),Ra();},L=()=>{n=false;for(let e of Array.from(t))e();t.clear(),Ga([]),Ia(),Sa();},M=()=>n,T=async(e,o)=>{await Da(e,o);};export{I as freeze,D as getElementContext,M as isFreezeActive,T as openFile,L as unfreeze};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-grab",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Select context for coding agents directly from your website",
5
5
  "keywords": [
6
6
  "agent",
@@ -28,6 +28,7 @@
28
28
  "files": [
29
29
  "bin",
30
30
  "dist",
31
+ "scripts/postinstall.cjs",
31
32
  "package.json",
32
33
  "README.md",
33
34
  "LICENSE"
@@ -84,7 +85,7 @@
84
85
  "@medv/finder": "^4.0.2",
85
86
  "bippy": "^0.5.32",
86
87
  "solid-js": "^1.9.10",
87
- "@react-grab/cli": "0.1.26"
88
+ "@react-grab/cli": "0.1.28"
88
89
  },
89
90
  "devDependencies": {
90
91
  "@babel/core": "^7.28.5",
@@ -116,6 +117,7 @@
116
117
  "css:watch": "tailwindcss -i ./src/styles.css -o ./dist/styles.css -w",
117
118
  "prebuild": "mkdir -p dist && tailwindcss -i ./src/styles.css -o ./dist/styles.css -m && node scripts/css-rem-to-px.mjs",
118
119
  "build": "NODE_ENV=production tsup",
120
+ "postinstall": "node ./scripts/postinstall.cjs",
119
121
  "dev": "concurrently \"pnpm:css:watch\" \"tsup --watch --ignore-watch dist\"",
120
122
  "lint": "oxlint",
121
123
  "lint:fix": "oxlint --fix",
@@ -0,0 +1,23 @@
1
+ const AUTOMATION_ENVIRONMENT_VARIABLE_NAMES = [
2
+ "CURSOR_AGENT",
3
+ "CI",
4
+ "CLAUDECODE",
5
+ "CODEX_CI",
6
+ "OPENCODE",
7
+ "AMP_HOME",
8
+ "AMI",
9
+ ];
10
+
11
+ const REACT_GRAB_INIT_COMMAND = "npx -y grab@latest init";
12
+ const INSTALL_HINT_MESSAGE = `[react-grab] Package installed via automation. This step only installs the package. Run \`${REACT_GRAB_INIT_COMMAND}\` to complete setup.`;
13
+
14
+ const isAlreadyRunningInit = Boolean(process.env.REACT_GRAB_INIT);
15
+
16
+ const isRunningInAutomatedEnvironment =
17
+ AUTOMATION_ENVIRONMENT_VARIABLE_NAMES.some((environmentVariableName) =>
18
+ Boolean(process.env[environmentVariableName]),
19
+ );
20
+
21
+ if (isRunningInAutomatedEnvironment && !isAlreadyRunningInit) {
22
+ console.log(INSTALL_HINT_MESSAGE);
23
+ }