react-grab 0.1.23 → 0.1.24
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/chunk-CHTY5GHQ.cjs +26 -0
- package/dist/chunk-UERZTOK6.js +101 -0
- package/dist/chunk-XWSK4QRO.cjs +101 -0
- package/dist/chunk-Z5IMKMDB.js +26 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.global.js +2 -2
- package/dist/index.js +2 -2
- package/dist/primitives.cjs +9 -0
- package/dist/primitives.d.cts +62 -0
- package/dist/primitives.d.ts +62 -0
- package/dist/primitives.js +9 -0
- package/dist/react.cjs +2 -2
- package/dist/react.js +2 -2
- package/package.json +12 -2
- package/dist/chunk-4CCAJASE.js +0 -118
- package/dist/chunk-VO5P2ZP5.cjs +0 -118
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Fiber } from 'bippy';
|
|
2
|
+
|
|
3
|
+
interface ReactGrabElementContext {
|
|
4
|
+
element: Element;
|
|
5
|
+
htmlPreview: string;
|
|
6
|
+
stackContext: string;
|
|
7
|
+
componentName: string | null;
|
|
8
|
+
fiber: Fiber | null;
|
|
9
|
+
selector: string | null;
|
|
10
|
+
styles: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Gathers comprehensive context for a DOM element, including its React fiber,
|
|
14
|
+
* component name, source stack, HTML preview, CSS selector, and computed styles.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const context = await getElementContext(document.querySelector('.my-button')!);
|
|
18
|
+
* console.log(context.componentName); // "SubmitButton"
|
|
19
|
+
* console.log(context.selector); // "button.my-button"
|
|
20
|
+
* console.log(context.stackContext); // "SubmitButton > Form > App"
|
|
21
|
+
*/
|
|
22
|
+
declare const getElementContext: (element: Element) => Promise<ReactGrabElementContext>;
|
|
23
|
+
/**
|
|
24
|
+
* Freezes the page by halting React updates, pausing CSS/JS animations,
|
|
25
|
+
* and preserving pseudo-states (e.g. :hover, :focus) on the given elements.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* freeze(); // freezes the entire page
|
|
29
|
+
* freeze([document.querySelector('.modal')!]); // freezes only the modal subtree
|
|
30
|
+
*/
|
|
31
|
+
declare const freeze: (elements?: Element[]) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Restores normal page behavior by re-enabling React updates, resuming
|
|
34
|
+
* animations, and releasing preserved pseudo-states.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* freeze();
|
|
38
|
+
* // ... capture a snapshot ...
|
|
39
|
+
* unfreeze(); // page resumes normal behavior
|
|
40
|
+
*/
|
|
41
|
+
declare const unfreeze: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns whether the page is currently in a frozen state.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* if (isFreezeActive()) {
|
|
47
|
+
* console.log('Page is frozen, skipping update');
|
|
48
|
+
* }
|
|
49
|
+
*/
|
|
50
|
+
declare const isFreezeActive: () => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Opens the source file at the given path in the user's editor.
|
|
53
|
+
* Tries the dev-server endpoint first (Vite / Next.js), then falls back
|
|
54
|
+
* to a protocol URL (e.g. vscode://file/…).
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* openFile("/src/components/Button.tsx");
|
|
58
|
+
* openFile("/src/components/Button.tsx", 42);
|
|
59
|
+
*/
|
|
60
|
+
declare const openFile: (filePath: string, lineNumber?: number) => Promise<void>;
|
|
61
|
+
|
|
62
|
+
export { type ReactGrabElementContext, freeze, getElementContext, isFreezeActive, openFile, unfreeze };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Fiber } from 'bippy';
|
|
2
|
+
|
|
3
|
+
interface ReactGrabElementContext {
|
|
4
|
+
element: Element;
|
|
5
|
+
htmlPreview: string;
|
|
6
|
+
stackContext: string;
|
|
7
|
+
componentName: string | null;
|
|
8
|
+
fiber: Fiber | null;
|
|
9
|
+
selector: string | null;
|
|
10
|
+
styles: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Gathers comprehensive context for a DOM element, including its React fiber,
|
|
14
|
+
* component name, source stack, HTML preview, CSS selector, and computed styles.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const context = await getElementContext(document.querySelector('.my-button')!);
|
|
18
|
+
* console.log(context.componentName); // "SubmitButton"
|
|
19
|
+
* console.log(context.selector); // "button.my-button"
|
|
20
|
+
* console.log(context.stackContext); // "SubmitButton > Form > App"
|
|
21
|
+
*/
|
|
22
|
+
declare const getElementContext: (element: Element) => Promise<ReactGrabElementContext>;
|
|
23
|
+
/**
|
|
24
|
+
* Freezes the page by halting React updates, pausing CSS/JS animations,
|
|
25
|
+
* and preserving pseudo-states (e.g. :hover, :focus) on the given elements.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* freeze(); // freezes the entire page
|
|
29
|
+
* freeze([document.querySelector('.modal')!]); // freezes only the modal subtree
|
|
30
|
+
*/
|
|
31
|
+
declare const freeze: (elements?: Element[]) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Restores normal page behavior by re-enabling React updates, resuming
|
|
34
|
+
* animations, and releasing preserved pseudo-states.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* freeze();
|
|
38
|
+
* // ... capture a snapshot ...
|
|
39
|
+
* unfreeze(); // page resumes normal behavior
|
|
40
|
+
*/
|
|
41
|
+
declare const unfreeze: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns whether the page is currently in a frozen state.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* if (isFreezeActive()) {
|
|
47
|
+
* console.log('Page is frozen, skipping update');
|
|
48
|
+
* }
|
|
49
|
+
*/
|
|
50
|
+
declare const isFreezeActive: () => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Opens the source file at the given path in the user's editor.
|
|
53
|
+
* Tries the dev-server endpoint first (Vite / Next.js), then falls back
|
|
54
|
+
* to a protocol URL (e.g. vscode://file/…).
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* openFile("/src/components/Button.tsx");
|
|
58
|
+
* openFile("/src/components/Button.tsx", 42);
|
|
59
|
+
*/
|
|
60
|
+
declare const openFile: (filePath: string, lineNumber?: number) => Promise<void>;
|
|
61
|
+
|
|
62
|
+
export { type ReactGrabElementContext, freeze, getElementContext, isFreezeActive, openFile, unfreeze };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {va,xa,ua,ma,Oa,Pa,za,Ba,Ca,Ma,Da,Na,ya}from'./chunk-UERZTOK6.js';/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 Aiden Bai
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
var H=async e=>{let t=await va(e),g=xa(e),z=ua(e),F=ma(e),v=Oa(e),C=Pa(e);return {element:e,htmlPreview:g,stackContext:t,componentName:z,fiber:F,selector:v,styles:C}},r=new Set,n=false,R=e=>{n=true,za(),r.add(Ba(e??[document.body])),Ca(),Ma();},D=()=>{n=false;for(let e of Array.from(r))e();r.clear(),Ba([]),Da(),Na();},I=()=>n,L=async(e,t)=>{await ya(e,t);};export{R as freeze,H as getElementContext,I as isFreezeActive,L as openFile,D as unfreeze};
|
package/dist/react.cjs
CHANGED
|
@@ -2152,7 +2152,7 @@ var VERSION, VIEWPORT_MARGIN_PX, OFFSCREEN_POSITION, SELECTION_LERP_FACTOR, FEED
|
|
|
2152
2152
|
var init_constants = __esm({
|
|
2153
2153
|
"src/constants.ts"() {
|
|
2154
2154
|
"use strict";
|
|
2155
|
-
VERSION = "0.1.
|
|
2155
|
+
VERSION = "0.1.24";
|
|
2156
2156
|
VIEWPORT_MARGIN_PX = 8;
|
|
2157
2157
|
OFFSCREEN_POSITION = -1e3;
|
|
2158
2158
|
SELECTION_LERP_FACTOR = 0.95;
|
|
@@ -15456,7 +15456,7 @@ var init_log_intro = __esm({
|
|
|
15456
15456
|
init_is_extension_context();
|
|
15457
15457
|
logIntro = () => {
|
|
15458
15458
|
try {
|
|
15459
|
-
const version = "0.1.
|
|
15459
|
+
const version = "0.1.24";
|
|
15460
15460
|
const logoDataUri = `data:image/svg+xml;base64,${btoa(LOGO_SVG)}`;
|
|
15461
15461
|
console.log(
|
|
15462
15462
|
`%cReact Grab${version ? ` v${version}` : ""}%c
|
package/dist/react.js
CHANGED
|
@@ -2140,7 +2140,7 @@ var VERSION, VIEWPORT_MARGIN_PX, OFFSCREEN_POSITION, SELECTION_LERP_FACTOR, FEED
|
|
|
2140
2140
|
var init_constants = __esm({
|
|
2141
2141
|
"src/constants.ts"() {
|
|
2142
2142
|
"use strict";
|
|
2143
|
-
VERSION = "0.1.
|
|
2143
|
+
VERSION = "0.1.24";
|
|
2144
2144
|
VIEWPORT_MARGIN_PX = 8;
|
|
2145
2145
|
OFFSCREEN_POSITION = -1e3;
|
|
2146
2146
|
SELECTION_LERP_FACTOR = 0.95;
|
|
@@ -15444,7 +15444,7 @@ var init_log_intro = __esm({
|
|
|
15444
15444
|
init_is_extension_context();
|
|
15445
15445
|
logIntro = () => {
|
|
15446
15446
|
try {
|
|
15447
|
-
const version = "0.1.
|
|
15447
|
+
const version = "0.1.24";
|
|
15448
15448
|
const logoDataUri = `data:image/svg+xml;base64,${btoa(LOGO_SVG)}`;
|
|
15449
15449
|
console.log(
|
|
15450
15450
|
`%cReact Grab${version ? ` v${version}` : ""}%c
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-grab",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Select context for coding agents directly from your website",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -69,6 +69,16 @@
|
|
|
69
69
|
"default": "./dist/react.cjs"
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
+
"./primitives": {
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./dist/primitives.d.ts",
|
|
75
|
+
"default": "./dist/primitives.js"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./dist/primitives.d.cts",
|
|
79
|
+
"default": "./dist/primitives.cjs"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
72
82
|
"./src/*": "./src/*",
|
|
73
83
|
"./styles.css": "./dist/styles.css",
|
|
74
84
|
"./dist/styles.css": "./dist/styles.css",
|
|
@@ -84,7 +94,7 @@
|
|
|
84
94
|
"@medv/finder": "^4.0.2",
|
|
85
95
|
"bippy": "^0.5.30",
|
|
86
96
|
"solid-js": "^1.9.10",
|
|
87
|
-
"@react-grab/cli": "0.1.
|
|
97
|
+
"@react-grab/cli": "0.1.24"
|
|
88
98
|
},
|
|
89
99
|
"devDependencies": {
|
|
90
100
|
"@babel/core": "^7.28.5",
|