@stefan.inc/feedback-engine 1.7.1 → 1.7.2

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 CHANGED
@@ -214,7 +214,7 @@ The package ships the [`feedback-accessibility`](https://github.com/smirea/feedb
214
214
  bunx feedback-engine init
215
215
  ```
216
216
 
217
- It links the skill into `.agents/skills/feedback-accessibility`, where agents that read the `.agents` folder find it by name, and adds a Feedback section to `AGENTS.md`, between `feedback-engine` markers. The section tells every agent what the editor is, how to read an export someone hands it, which skill to follow when it changes a screen, and how to check a screen with [`capture()`](#drive-it-from-a-script). When the app also has a `CLAUDE.md` that does not mention `AGENTS.md`, the section goes there too. Commit both: the link points into `node_modules`, so the skill always matches the installed version. Run `init` again after an upgrade to refresh the section. In a monorepo, run it from the repository's root: it finds the package in the workspace that installed it, so the skill and the section sit where every agent in the repository reads them.
217
+ It links the skill into `.agents/skills/feedback-accessibility`, where agents that read the `.agents` folder find it by name, and adds a Feedback section to `AGENTS.md`, between `feedback-engine` markers. The section tells every agent what the editor is, how to read an export someone hands it, which skill to follow when it changes a screen, and how to check a screen with [`capture()`](#drive-it-from-a-script). When the app also has a `CLAUDE.md` that does not mention `AGENTS.md`, the section goes there too. Commit both: the link points into `node_modules`, so the skill always matches the installed version. Run `init` again after an upgrade to refresh the section. In a monorepo, run it from the repository's root as `bunx --package @stefan.inc/feedback-engine feedback-engine init`, since the root's `node_modules/.bin` has no `feedback-engine` and a bare `bunx feedback-engine` would look for another package on npm. It finds the package in the workspace that installed it, so the skill and the section sit where every agent in the repository reads them.
218
218
 
219
219
  ## Give feedback
220
220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stefan.inc/feedback-engine",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "In-app feedback for Svelte and React: point at a component, write what should change, and export its name, file:line, and data for an agent.",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -150,7 +150,26 @@ function svgImageURL(svg: SVGElement) {
150
150
  * Safari 2.4 s on a page with 20 icons, so the copy is drawn once and waits one interval in all.
151
151
  */
152
152
  async function svgImage(node: Element, options: Options) {
153
- const context = await createContext(node, options);
153
+ // modern-screenshot leaves a scrolled container's copy at its top unless `restoreScrollPosition` is on, which shifts
154
+ // the children of a scrolled element by its scroll. The window's scroll is the root's, and the copy of the document
155
+ // must start at its top, so the shift is taken back off the root's children.
156
+ const transforms = new WeakMap<Node, string>();
157
+ const scrolledRoot = node === document.scrollingElement && (node.scrollTop !== 0 || node.scrollLeft !== 0);
158
+ const context = await createContext(node, {
159
+ ...options,
160
+ features: { restoreScrollPosition: true },
161
+ onCloneEachNode: scrolledRoot
162
+ ? clone => void (clone instanceof HTMLElement && transforms.set(clone, clone.style.transform))
163
+ : undefined,
164
+ onCloneNode: scrolledRoot
165
+ ? clone => {
166
+ for (const child of (clone as HTMLElement).children as HTMLCollectionOf<HTMLElement>) {
167
+ const transform = transforms.get(child);
168
+ if (transform !== undefined) child.style.transform = transform;
169
+ }
170
+ }
171
+ : undefined,
172
+ });
154
173
  try {
155
174
  const svg = await domToForeignObjectSvg(context);
156
175
  const image = await loadMedia(svgImageURL(svg), { timeout: context.timeout });