diff --git a/.changeset/remove-style-feature.md b/.changeset/remove-style-feature.md deleted file mode 100644 index 6684b0dd3..000000000 --- a/.changeset/remove-style-feature.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"react-grab": minor -"grab": minor -"@react-grab/cli": minor ---- - -Remove the Style action and panel, including its keyboard shortcuts, inline previews, CSS property controls, design-token handling, and edit-related action context and renderer types. Simplify the toolbar to its Copy control while keeping Comment available through the context menu and action menu. diff --git a/.changeset/semantic-selector-context.md b/.changeset/semantic-selector-context.md deleted file mode 100644 index 55fbe14d7..000000000 --- a/.changeset/semantic-selector-context.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"react-grab": patch ---- - -Improve copied element context and labels with stable semantic selectors, authored component names, nearest-source resolution, race-safe refresh-aware source caching, bounded previews and keys, nested control labels, consistent trace budgets, and lossless multi-element selection. diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index f55a94653..cedeec8cd 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,11 @@ # @react-grab/cli +## 0.2.0 + +### Minor Changes + +- f350003: Remove the Style action and panel, including its keyboard shortcuts, inline previews, CSS property controls, design-token handling, and edit-related action context and renderer types. Simplify the toolbar to its Copy control while keeping Comment available through the context menu and action menu. + ## 0.1.50 ## 0.1.49 diff --git a/packages/cli/package.json b/packages/cli/package.json index a0fb6d7e9..1d3e35cf5 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@react-grab/cli", - "version": "0.1.50", + "version": "0.2.0", "repository": { "type": "git", "url": "git+https://github.com/aidenybai/react-grab.git" diff --git a/packages/grab/CHANGELOG.md b/packages/grab/CHANGELOG.md index 283a79830..756677861 100644 --- a/packages/grab/CHANGELOG.md +++ b/packages/grab/CHANGELOG.md @@ -1,5 +1,16 @@ # grab +## 0.2.0 + +### Minor Changes + +- f350003: Remove the Style action and panel, including its keyboard shortcuts, inline previews, CSS property controls, design-token handling, and edit-related action context and renderer types. Simplify the toolbar to its Copy control while keeping Comment available through the context menu and action menu. + +### Patch Changes + +- Updated dependencies [f350003] + - @react-grab/cli@0.2.0 + ## 0.1.50 ### Patch Changes diff --git a/packages/grab/package.json b/packages/grab/package.json index afe2f67a5..3906b1035 100644 --- a/packages/grab/package.json +++ b/packages/grab/package.json @@ -1,6 +1,6 @@ { "name": "grab", - "version": "0.1.50", + "version": "0.2.0", "description": "Select context for coding agents directly from your website", "keywords": [ "agent", diff --git a/packages/react-grab/CHANGELOG.md b/packages/react-grab/CHANGELOG.md index 05d43a55b..494e8386e 100644 --- a/packages/react-grab/CHANGELOG.md +++ b/packages/react-grab/CHANGELOG.md @@ -1,5 +1,17 @@ # react-grab +## 0.2.0 + +### Minor Changes + +- f350003: Remove the Style action and panel, including its keyboard shortcuts, inline previews, CSS property controls, design-token handling, and edit-related action context and renderer types. Simplify the toolbar to its Copy control while keeping Comment available through the context menu and action menu. + +### Patch Changes + +- 4dbdee5: Improve copied element context and labels with stable semantic selectors, authored component names, nearest-source resolution, race-safe refresh-aware source caching, bounded previews and keys, nested control labels, consistent trace budgets, and lossless multi-element selection. +- Updated dependencies [f350003] + - @react-grab/cli@0.2.0 + ## 0.1.50 ### Patch Changes diff --git a/packages/react-grab/e2e/csp.spec.ts b/packages/react-grab/e2e/csp.spec.ts new file mode 100644 index 000000000..11cb45a49 --- /dev/null +++ b/packages/react-grab/e2e/csp.spec.ts @@ -0,0 +1,46 @@ +import { expect, test } from "./fixtures.js"; + +const STRICT_STYLE_POLICY = "style-src 'self' 'unsafe-inline'"; +const GOOGLE_FONTS_STYLESHEET_HOST = "fonts.googleapis.com"; + +test("does not load an external font stylesheet under a strict style CSP", async ({ + reactGrab, +}) => { + const cspViolations: string[] = []; + + reactGrab.page.on("console", (message) => { + if ( + message.type() === "error" && + message.text().includes("Content Security Policy") && + message.text().includes(GOOGLE_FONTS_STYLESHEET_HOST) + ) { + cspViolations.push(message.text()); + } + }); + + await reactGrab.page.route("**/*", async (route) => { + if (route.request().resourceType() !== "document") { + await route.continue(); + return; + } + + const response = await route.fetch(); + await route.fulfill({ + response, + headers: { + ...response.headers(), + "content-security-policy": STRICT_STYLE_POLICY, + }, + }); + }); + + await reactGrab.page.reload({ waitUntil: "domcontentloaded" }); + await expect.poll(() => reactGrab.getOverlayHost().count()).toBe(1); + + const overlayStyles = await reactGrab.getOverlayHost().evaluate((host) => { + return host.shadowRoot?.querySelector("style")?.textContent ?? ""; + }); + + expect(overlayStyles).not.toContain(GOOGLE_FONTS_STYLESHEET_HOST); + expect(cspViolations).toEqual([]); +}); diff --git a/packages/react-grab/package.json b/packages/react-grab/package.json index 058893c19..2829bae3c 100644 --- a/packages/react-grab/package.json +++ b/packages/react-grab/package.json @@ -1,6 +1,6 @@ { "name": "react-grab", - "version": "0.1.50", + "version": "0.2.0", "description": "Select context for coding agents directly from your website", "keywords": [ "agent", diff --git a/packages/react-grab/src/utils/mount-root.ts b/packages/react-grab/src/utils/mount-root.ts index f2f0de4a1..d49206df6 100644 --- a/packages/react-grab/src/utils/mount-root.ts +++ b/packages/react-grab/src/utils/mount-root.ts @@ -3,9 +3,6 @@ import { detectCspNonce } from "./detect-csp-nonce.js"; import { hideFromThirdParties } from "./hide-from-third-parties.js"; import { REACT_GRAB_ATTRIBUTE_NAME } from "./react-grab-attribute-name.js"; -const FONT_IMPORT = - '@import url("https://fonts.googleapis.com/css2?family=Geist:wght@500&display=swap");'; - // Mounting into
(not ) keeps React hydration happy: appending a //