From 9ccb240dc71c8fb1d2f4e12b5ea124ae187fd810 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Tue, 21 Apr 2026 15:30:09 -0700 Subject: [PATCH] fix(live): variant outline accuracy and shader re-anchor after wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two regressions surfaced in smoke testing, both traceable to state drift when live-wrap.mjs rewrites the source file and HMR swaps the DOM. 1. Variant outline on the wrong element. The skill rewrite lost the explicit "each variant must be a complete element replacement" rule and dropped the "full element replacement" comments from variants 2 and 3. Models started producing variants with loose sibling children, so live-browser's :first-child selector framed only the first sibling. Restored the rule, made all three comments consistent, and replaced :first-child with pickVariantContent — which skips non-visual tags (style/script/link/meta/template) and falls back to the variant div itself when a model still ships multiple visual children. 2. Loading shader freezes after wrap. The MutationObserver only woke up when new non-original variants arrived, so when the wrapper first appeared via HMR with just the original inside, selectedElement was left dangling on the now-detached pre-wrap node. Scroll-tracking read a zero rect on every frame and collapsed the shader canvas to 0x0. The observer now re-anchors selectedElement to the original's content the moment the wrapper shows up, keeping overlays positioned until real variants land. Co-Authored-By: Claude Opus 4.7 (1M context) --- .agents/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .claude/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .cursor/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .gemini/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .github/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .kiro/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .opencode/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .pi/skills/impeccable/reference/live.md | 8 +++-- .pi/skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .rovodev/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .trae-cn/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- .trae/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- source/skills/impeccable/reference/live.md | 8 +++-- .../skills/impeccable/scripts/live-browser.js | 31 +++++++++++++++++-- 24 files changed, 396 insertions(+), 72 deletions(-) diff --git a/.agents/skills/impeccable/reference/live.md b/.agents/skills/impeccable/reference/live.md index 78286597b..892efaa2c 100644 --- a/.agents/skills/impeccable/reference/live.md +++ b/.agents/skills/impeccable/reference/live.md @@ -147,16 +147,18 @@ Write CSS + all variants in ONE edit at the `insertLine` reported by `wrap`. Col @scope ([data-impeccable-variant="2"]) { ... }
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `
- +
- +
- +
``` +**Each variant div contains exactly one top-level element — the full replacement for the original.** Use the same tag as the original (e.g. `
` if the user picked a `
`). Loose siblings (heading + paragraph + div as direct children of the variant div) break the outline tracking and the accept flow, which both assume one child. + The first variant has no `display: none` (visible by default). All others do. If variants use only inline styles and no scoped CSS, omit the `