Wix Harmony Editor
WixOfficialPublished by Wix
- Skill
- Tool integration
- Software development
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The wix-harmony-editor skill provides a framework for programmatically interacting with the Wix Harmony editor. It uses a local Chrome instance launched via CDP to allow an AI agent to inspect, modify, and verify website components and layouts. The skill includes a suite of scripts for tasks such as copying site pages, managing media, and performing responsive layout adjustments, while adhering to strict safety guidelines regarding site publication and dashboard data access.
What it does
- Connects to an authenticated Wix Harmony editor session via Playwright and CDP.
- Provides access to the internal editor API for component inspection and layout manipulation.
- Supports automated site migration and page copying workflows.
- Includes utility scripts for media management, preview comparisons, and responsive design verification.
- Enforces safety protocols to prevent unauthorized site publishing or dashboard data modification.
When to use it
- When you need to perform bulk updates or complex layout adjustments within the Wix Harmony editor.
- When migrating content from an existing website into a new Wix Harmony site.
- When verifying responsive design behavior across different viewport widths.
- When you need to programmatically inspect component properties or styles that are not easily accessible via the standard UI.
Advantages
- Enables precise, repeatable programmatic control over editor components.
- Reduces manual effort for repetitive site-building or migration tasks.
- Provides tools for validating responsive scaling and layout integrity.
- Maintains a clear separation between front-end editing and sensitive dashboard data.
Usage examples
- “Inspect the layout properties of the hero section with ID 'hero-123' in the current editor.”
- The agent uses the editor API to fetch and return the layout, composition, and measured dimensions of the specified component.
- “Update the height of the component 'frame-456' to 500px.”
- The agent executes a script to set the component size and verifies the change by reading back the updated layout state.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wix/wix-harmony-editor/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip wix-harmony-editor.zip -d .agents/skills
Documentation by Wix
Wix Harmony editor
Work through the Wix Harmony editor, not the published site. Use the local Chrome launcher and Playwright; the standard in-app browser may not expose the isolated Chrome CDP session.
This file is how to connect to the editor and work in it. Copying an existing site's page into Harmony has its own rules: read COPY-SITE.md before starting a copy.
Order for a migration: create the site, then bring the data (store, bookings, blog and other app data, public and/or private), then build the front end here. Do not start the editor for a store or other app-backed site before its data is in, unless the user asks and approves (COPY-SITE.md, "Order").
Safety and scope
Treat the editor as a persistent external system. Inspect before writing.
Obtain clear user authorization immediately before a persistent change unless the request already explicitly authorizes that exact change. State the component and intended effect.
Never publish unless the user explicitly asks. Saving a draft is not publishing.
Work only on visible front-end editor content. Dashboard data (Stores, Bookings, contacts, orders, coupons, members, blog posts, or settings) is out of scope. Site media and fonts that the page displays are front-end content and in scope.
The launcher uses a separate Chrome profile. Never use, copy, or inspect the user's normal Chrome profile.
Do not expose cookies, local storage, headers, session data, or CDP WebSocket URLs. Use only the local
http://127.0.0.1:9333endpoint launched for this task.If the sandbox blocks
connectOverCDPwithEPERM, request elevation specifically for the local loopback connection. Do not use a remote host, a different port, or a workaround that exposes the debugger.
Launch and authenticate
Run the bundled launcher with the Wix editor URL:
skills/wix-harmony-editor/scripts/launch.sh 'https://example.editor.wix.com/edit/...'It starts a headed Chrome instance with an isolated, private profile and a loopback-only CDP port. If Wix shows a sign-in page, let the user authenticate in that browser. Never ask for or enter credentials yourself.
The launcher is intentionally quiet about CDP internals. It reports only whether local Chrome is reachable.
The first launch usually lands on users.wix.com/signin. Tell the user to sign in in that
window (the account that owns the site), then poll until the editor tab exists and
window.repluggableAppDebug is defined. Do not treat the sign-in page as an error.
Attach with Playwright
Confirm the expected editor is open before doing anything else:
node --input-type=module -e "
import { chromium } from 'playwright';
const browser = await chromium.connectOverCDP('http://127.0.0.1:9333');
const pages = browser.contexts().flatMap(context => context.pages());
console.log(await Promise.all(pages.map(async page => ({ url: page.url(), title: await page.title() }))));
await browser.close();
"In a Playwright script, resolve the editor page mechanically:
const page = browser.contexts()
.flatMap(context => context.pages())
.find(page => page.url().includes('editor.wix.com/edit/'));
if (!page) throw new Error('No authenticated Wix Harmony editor page is open.');browser.close() detaches Playwright; it does not close the launched Chrome instance.
Initialize and use the Harmony API
All API code runs in page.evaluate:
const api = await repluggableAppDebug.host.getAPI({
name: 'RunEditorLLMCodeToolAPI',
public: true,
layer: 'DATA_SERVICE',
});Execute editor code with the required editor context:
await api.execute(
{ code: 'return await editorLLMApis.catalog.list();' },
{ biParams: {} },
);The { biParams: {} } second argument is required in this workflow. Omitting it produces Cannot read properties of undefined (reading 'biParams'); that error changed nothing in the observed case, but do not use failed calls to discover write signatures.
Discover before acting
Start with
editorLLMApis.catalog.list()for namespace orientation.Read documentation only for namespaces needed by the task, in one documentation-only call:
return await editorLLMApis.catalog.describe({ namespaces: ['pages', 'components', 'layout', 'breakpoints', 'appearance', 'site'], });describehas a response budget. A namespace that does not fit comes back as[NOT RETURNED …]or[Truncated …]; fetch that one alone withcatalog.describe({ namespaces: ['<name>'] }).components,richText,media,layoutandappearanceeach need their own call. Save the docs to files and read them from there instead of re-fetching.Never introspect undocumented API objects or guess a write method's arguments.
Open/focus the correct page before reads, because component reads resolve against the focused page.
Use IDs, element paths, units, tokens, and schemas returned by live reads—never assumed values.
After every write, do a fresh read of the normalized, user-visible result. A write echo alone is not verification.
Common namespaces: pages (focus the page), components (find and inspect), layout (measure and resize), breakpoints (desktop/mobile view), appearance (borders/backgrounds), and site (save/publish status).
Execution pattern
const result = await page.evaluate(async () => {
const api = await repluggableAppDebug.host.getAPI({
name: 'RunEditorLLMCodeToolAPI',
public: true,
layer: 'DATA_SERVICE',
});
return api.execute({
code: `
const focused = await editorLLMApis.pages.getFocused();
return { focused };
`,
}, { biParams: {} });
});Check the returned action result for errors before taking the next step.
A failed snippet reports completedCalls with the ids it created. Those writes persist:
continue from the failed call reusing those ids, never re-run the whole snippet.
Bundled scripts
Run from this skill's directory. They import playwright, resolved from the working tree.
| Script | Use |
|---|---|
scripts/launch.sh <editorUrl> | Start the isolated, headed Chrome on loopback CDP 9333. |
node scripts/copy/lint-api.mjs --capabilities caps.json [--snippet] <file…> | Check every A.<ns>.<method>( call against the editor's real method list (recorded by snapshot-capabilities.mjs) before it is sent. |
node scripts/copy/editor-run.mjs <snippet.js> [--site <metaSiteId>] [--capabilities caps.json] | Run one editor-API snippet kept in a file; prints result or the failure summary. Lints the snippet when --capabilities / HARMONY_CAPABILITIES is set. Prefer this over inline -e code (no quoting bugs, replayable record). |
node scripts/copy/upload-media-manager.mjs <sectionId> <file…> | Upload local files to the site's Media Manager through the editor's own dialog. |
node scripts/copy/compare-preview.mjs <sourceUrl> <outDir> | Editor Preview at true canvas width vs the source, plus stacked zoom crops. |
node scripts/copy/preview-widths.mjs <sourceUrl> <outDir> --widths … [--scale-check <sectionId>] | Preview at exact widths (slider) vs the source, plus a check that every element scales with the width. |
node scripts/copy/build-description.mjs, check-description.mjs, deploy-description.mjs | Page description → local compliance/overlap/render check → one-pass deploy with read-back; see COPY-SITE.md. |
node scripts/copy/export-page.mjs, snapshot-capabilities.mjs, import-media.mjs | Recipes from a copied page, the editor's accepted schemas, public images imported by URL. |
node scripts/copy/mobile-stage.mjs hide|bg-opacity … | The two mobile-only changes with no API: Hide, and the background image opacity. |
node scripts/copy/mirror-site.mjs, serve-mirror.mjs, check-mirror.mjs | Offline copy of the source site, served locally and pixel-checked against live; see COPY-SITE.md step 0. |
node scripts/copy/measure-source.mjs, node scripts/copy/render-plate.mjs | Site copying; see COPY-SITE.md. |
Editor behaviors learned live
These hold for the Harmony editor API as observed; check the live read when one disagrees.
Global header and footer.
sections.listreturns the page's header/footer as aRefComponent(role: header|footer); background and layout writes on that id are refused. Target itsmasterId(onmasterPage) forsetContainerBackground,components.addandlayout.*.Text inside the global header/footer refuses the text-panel actions (
richText.setColor,setLink,setAlign,setFontFamily: "cannot be selected"). Style it withappearance.setStyleson the text component (color,textAlign,fontFamily,fontSize,lineHeight, …). For a link, put an inline<a href>inrichText.setTextHTML (it survives), or use a Button withlinks.set.Header/footer height has two parts. Each has an internal container (
wixSystemElements.InternalContainer, child of the master; find it in the stage DOM as[class*="internalContainerRoot"]under#<pageHeaderOrFooterId>). The background layer and the visible height follow the internal container, not the header/footer box.layout.setSizeboth to the same height; the background may update only after the nextsetContainerBackground. The internal container's grid rows are[minContent, 1fr]: a second text block that stacks under the first can be clipped. Merge lines into one rich text with<br>instead.Freeform layout is a grid of rows. A section places each child in a grid row with margins.
layout.setCompositionresolves all of a container's children as one set and rejects the whole arrangement if any two boxes overlap or leave the container, sometimes silently, leaving the auto-placed positions. Even sub-pixel overlaps of touching text boxes count. Send one complete, overlap-free arrangement per container, readgetCompositionback, and fix the inputs. Do not correct drift withlayout.moveafter a composition: it re-flows the rows and makes it worse.Content-sized boxes. Rich text height is
lines × line-height. A single-line text whose box is exactly as wide as its words can wrap on a sub-pixel font difference and push everything below it down. Give single-line boxes ≥10 px of slack (left-aligned, so the text start does not move). Buttons grow to fit a wrapped label;setSizeheight on a content-sized axis is only a minimum.Sizes scale with the viewport (spx). Font sizes, margins and box sizes written in px are stored as
spx(scaled to the 1280 reference width), so a desktop layout grows and shrinks proportionally between the desktop breakpoints. Anything that stays a realpxbreaks that proportion: alineHeight: '42px'on text, a px line-height inside a button label, a px section height. Write line heights asemratios ('1.4em'), writefontSizeandlineHeightin the samesetStylescall (writing onlylineHeightcan rescale the stored font size), and read both back. Prove it withpreview-widths.mjs --scale-check: every child must scale byw2/w1.Auto-height sections. A section added with
sections.addhasheight: auto, set by its content rows, so it scales with the page. A section that came with the template, or one whose height was set withlayout.setSize, has a fixedpxheight that does not scale. For a copied page, use a new auto-height section and move the content into it withcomponents.canReparent+components.reparent(ids and styles are kept).Desktop vs mobile views. The mobile view (below 1024 px) shows the same components. Per view through the API, in the mobile view:
layout.setCompositionpositions, widths and the sectionbox.height. Shared (a write in mobile view changes desktop too): image heights (send none on mobile, the ratio derives them),layout.setSize,appearance.setStyles,appearance.setContainerBackground. Stage-only, per view: Hide and the background image opacity (scripts/copy/mobile-stage.mjs).Classic scrollbars shrink the canvas. With an always-visible OS scrollbar the stage loses 15 px: a desktop section reads 1265 instead of 1280, a mobile one 375 instead of 390, and every composition then lands off (a deploy reports dozens of differences; switching the OS setting between a trackpad and a mouse does this). The copy scripts call
hide-scrollbars.mjs(Emulation.setScrollbarsHidden, which lasts only while their CDP session is attached). If you drive the editor another way, checklayout.getCompositionon a section: width must be 1280/390.Compositions are anchored, not absolute. Each child is kept relative to the one above it. When a child ends up shorter or taller than the box sent (a new text that reflows, an image height off its ratio, a Button below its label height), everything after it moves. Send the heights the engine will compute and re-send the set until
getCompositionmatches (deploy-description.mjsdoes both).Rich text.
setTextkeeps inline<span style="color|font-weight|font-family|font-size">and<a href>as sent (apxfont size in a span does not scale: useem).links.seton a rich text rewrites it: the root becomes<h1>with an underline span. Keep text links inline. A plain single line goes throughinjectText.Buttons size to their label. A set height is a minimum; a tall transparent click area gets its height from the label
lineHeightinem.Results over ~50 KB are truncated (
"[Truncated: … chars]"in place of the value). Read in batches, or compare inside the snippet and return only the differences.pages.addcreates an empty placeholder section (shouldReuse: true); a deploy that adds its own section removes it.Hide is per view, and only from mobile. Right-click a component or section on the mobile stage → Hide hides it on mobile only. Desktop has no Hide (it is the base view), so content can be hidden from mobile but never from desktop. Un-hide in the Layers panel → Hidden on mobile → the eye button on the row (
[data-hook="layers-item@DESKTOP--<id>"] button).Global header/footer are hard to make responsive. They are a single row (
[minContent, 1fr]grid) and their background does not follow the page content. For an exact copy, collapse them (header, footer and their internal containers set to 1 px, background transparent) and build the nav and footer inside the page's own section, where they scale with everything else.Media.
media.uploadFilesaccepts only temporary wixmp chat URLs. Import public web images from a copied page withscripts/copy/import-media.mjs, which downloads each one itself (global-unicast destinations only, at most 10 MB, six at a time, once per distinct URL) and uploads the bytes throughPOST https://www.wixapis.com/site-media/v1/files/generate-upload-url(site token, headerwix-site-id); never pass an untrusted page's URL tofiles/import, which makes Wix fetch it. Then read theuriwithmedia.searchSiteFiles. Upload local files withscripts/copy/upload-media-manager.mjs. Image values forcontent.setare{ uri, name, alt, width, height }; adddisplayMode: 'fit'to show the whole image.Fonts. Only the editor's catalog and the site's uploaded fonts render. Importing a
.ttfthrough the media API creates a FONT file that is not registered. Register fonts through the editor: select any text, open the font dropdown in the text toolbar, click Upload fonts, then feedinput[type=file][accept*=".ttf"]withsetInputFiles. Afterwardsfonts.resolve('<Name>')refuses but suggests the uploaded family (wfont_<x>_<id>,wf_<id25>,orig_<name>): use that full string asfontFamily.Buttons as text links. A Button with transparent background, zero borders/padding and a styled
labelelement is the reliable linked text in global header/footer. Theme button looks are saved styles: restyle one button locally, thenthemeComponents.updateFromComponent({ kind: 'button', styleId: 'button-primary', … }).Pinned elements.
layout.pinToScreen({ position: 'center-bottom', offsetPx })pins a floating button and moves it to the page (out of the section). A pinned component cannot be resized: set its size first, or unpin, resize and pin again.Tokens expire. A CLI site token (
npx @wix/cli@latest token --site <id>) stops working during a long session (REST calls start returning 403). Re-mint and retry once before diagnosing anything else.True-width Preview. The Preview frame defaults to 1280 px whatever the window size. Its width slider (
[data-hook="slider-handle"],aria-valuenow, range 390 to the window width minus 84) is only rendered while the window is at least ~1300 px wide. Click the slider track near the target, then use the arrow keys for the exact width (preview-widths.mjsdoes this). A free site adds a 44 px "Upgrade" banner above the page. The editor stage is zoomed (Fit (60–110%)), so stage screenshots are not a pixel reference.Watch the published state.
site.getStatus().isPublishedbecametrueduring scripted UI work on this site, cause unknown. Read it before and after UI automation, never click by raw coordinates in the top bar (Publish is there), and report a change to the user instead of quietly reverting it.
Example: make a hero frame responsive
When a hero frame scales in width but its text overflows at wide desktop sizes, find visible title text, inspect its ancestors, and identify the bordered frame container:
const title = await editorLLMApis.components.find({
textContains: 'Hero title',
limit: 20,
});
const inspection = await editorLLMApis.components.inspect({
componentId: title.components[0].id,
aspects: ['layout', 'styles'],
neighbourhood: true,
});Read the frame's declared layout and composition. A typical problem is a percentage width paired with fixed pixel height while the text uses spx sizing:
const frameId = 'REPLACE_WITH_FRAME_COMPONENT_ID';
const layout = await editorLLMApis.layout.get({ componentId: frameId });
const composition = await editorLLMApis.layout.getComposition({ componentId: frameId });
const measured = await editorLLMApis.layout.measure({ componentId: frameId });
return { layout, composition, measured };For a frame declared as height: { value: 536, unit: 'px' }, the responsive repair is normally to preserve the value and use Wix scaled pixels. After authorization:
const updated = await editorLLMApis.layout.setSize({
componentId: frameId,
height: 536, // plain pixels: the component keeps its own unit (spx stays spx) and the value is recomputed
});
const verifiedLayout = await editorLLMApis.layout.get({ componentId: frameId });
const status = await editorLLMApis.site.getStatus();
return { updated, verifiedLayout, status };Verify that the stored height is { type: 'spx', value: 536 }, that the editor reports a successful save state, and that the site remains unpublished unless publication was explicitly requested.
Files
- .publish-manifest.json218 B
- ATTRIBUTION.mdAdded by AutoGineer823 B
- COPY-SITE.md39.8 KiB
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md19.4 KiB
- VERSION6 B
- scripts/copy/build-description.mjsScript23.2 KiB
- scripts/copy/check-description.mjsScript23.0 KiB
- scripts/copy/check-mirror.mjsScript6.7 KiB
- scripts/copy/compare-preview.mjsScript4.5 KiB
- scripts/copy/deploy-description.mjsScript20.5 KiB
- scripts/copy/desc-hash.mjsScript3.0 KiB
- scripts/copy/editor-run.mjsScript3.1 KiB
- scripts/copy/export-page.mjsScript4.8 KiB
- scripts/copy/find-interactions.mjsScript6.5 KiB
- scripts/copy/hide-scrollbars.mjsScript1.1 KiB
- scripts/copy/import-media.mjsScript6.9 KiB
- scripts/copy/link-url.mjsScript1.5 KiB
- scripts/copy/lint-api.mjsScript3.3 KiB
- scripts/copy/measure-source.mjsScript19.9 KiB
- scripts/copy/media-import.mjsScript4.8 KiB
- scripts/copy/merge-mirrors.mjsScript1.9 KiB
- scripts/copy/mirror-site.mjsScript5.3 KiB
- scripts/copy/mobile-stage.mjsScript5.3 KiB
- scripts/copy/preview-widths.mjsScript6.6 KiB
- scripts/copy/public-address.mjsScript3.6 KiB
- scripts/copy/render-plate.mjsScript4.3 KiB
- scripts/copy/serve-mirror.mjsScript7.9 KiB
- scripts/copy/snapshot-capabilities.mjsScript3.9 KiB
- scripts/copy/split-sections.mjsScript16.7 KiB
- scripts/copy/upload-media-manager.mjsScript4.0 KiB
- scripts/launch.shScript15.6 KiB
scripts/copy/measure-source.mjs
#!/usr/bin/env node
// Measure a live source page so it can be copied exactly into Harmony.
//
// node scripts/copy/measure-source.mjs <url> <out.json> [--width 1280] [--height 900]
//
// Writes one JSON file with everything the copy needs, in page coordinates at --width:
// page height, and a centering check (the same layout rendered 640px wider:
// a constant dx of 320 means a centered fixed-width layout, so a wider
// background plate lines up with the narrower canvas)
// backgrounds every element with a background image or a non-transparent colour
// images every visible <img>: src, natural size, rendered box, alt, link
// texts one entry per text BLOCK: the block box, the first line's top
// (lineTop), font family/size/weight/colour/line-height/letter-spacing,
// alignment, inner HTML, explicit <br> breaks and links, plus:
// rich Harmony-ready rich-text HTML: links kept, <br> kept, images and
// nested blocks dropped, and every run whose colour, weight,
// style, decoration, family or size differs from the text's own
// base style (font/size/color below) as an
// inline <span style> (sizes as em, so they scale)
// segments only when the text wraps around a float (its lines start at
// different x): one {rich, box, lineTop, lines} per run of lines
// sharing a left edge, box width = the space the lines wrap in
// lines, linePitch painted line count and the real distance between lines
// (can differ from lineHeight when inline content is bigger)
// occluded true when something else is painted over all of the first line:
// usually not copied
// hiddenText the words are not painted (image replacement, text-indent
// -9999px): with a link the box is a click area over artwork
// (copy as a transparent link button), without one skip it
// fixed position:fixed elements (floating buttons, chat widgets) incl. shadow DOM
// unsupported iframes, video/audio, canvas, forms and form controls, inline svg: not rebuilt by
// this method; build-description turns each into a `review` item
//
// Read only. It never logs in and never sends anything to the source.
import { chromium } from 'playwright';
import fs from 'node:fs';
const args = process.argv.slice(2);
const opt = (name, dflt) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : dflt; };
const [url, out] = args.filter((a, i) => !a.startsWith('--') && !(i > 0 && args[i - 1].startsWith('--')));
if (!url || !out) { console.error('usage: measure-source.mjs <url> <out.json> [--width 1280] [--height 900]'); process.exit(2); }
const width = Number(opt('width', 1280));
const height = Number(opt('height', 900));
const browser = await chromium.launch();
async function measure(w) {
const page = await browser.newPage({ viewport: { width: w, height } });
await page.goto(url, { waitUntil: 'networkidle', timeout: 90000 });
await page.waitForTimeout(1500);
const data = await page.evaluate(() => {
const R = (r) => ({ x: Math.round(r.x), y: Math.round(r.y + scrollY), w: Math.round(r.width), h: Math.round(r.height) });
const visible = (e) => { const s = getComputedStyle(e); return s.display !== 'none' && s.visibility !== 'hidden' && +s.opacity > 0; };
const backgrounds = [], images = [], texts = [], fixed = [], unsupported = [];
for (const e of document.querySelectorAll('body *')) {
if (!visible(e)) continue;
const s = getComputedStyle(e), r = e.getBoundingClientRect();
if (r.width < 1 || r.height < 1) continue;
const hasImg = s.backgroundImage && s.backgroundImage !== 'none';
const hasColor = !/rgba\(0, 0, 0, 0\)|transparent/.test(s.backgroundColor);
if (hasImg || hasColor) backgrounds.push({ tag: e.tagName, id: e.id || null, cls: String(e.className || '').slice(0, 80), box: R(r), image: hasImg ? s.backgroundImage : null, repeat: s.backgroundRepeat, position: s.backgroundPosition, size: s.backgroundSize, color: s.backgroundColor, radius: s.borderRadius });
// things this copy method does not rebuild (it only knows text, images, buttons and the plate): listed so
// nothing is dropped silently. Hidden/aria-hidden tracking pixels are skipped by visible() above.
if (/^(IFRAME|VIDEO|AUDIO|CANVAS|OBJECT|EMBED|FORM|INPUT|SELECT|TEXTAREA|SVG)$/i.test(e.tagName) && !(e.tagName.toUpperCase() === 'INPUT' && e.type === 'hidden') && !e.closest('svg:not(:scope)') && !(e.tagName.toUpperCase() === 'SVG' && r.width < 24 && r.height < 24)) unsupported.push({ tag: e.tagName.toLowerCase(), src: e.currentSrc || e.src || e.action || null, box: R(r) });
if (e.tagName === 'IMG' && e.dataset.embedSrc) { unsupported.push({ tag: 'iframe', src: e.dataset.embedSrc, box: R(r) }); continue; } // the offline copy swapped an iframe for a snapshot image: still an embed, not a picture
if (e.tagName === 'IMG') images.push({ src: e.currentSrc || e.src, natural: [e.naturalWidth, e.naturalHeight], box: R(r), alt: e.alt || '', href: e.closest('a') ? e.closest('a').href : null });
}
// floats only push lines of text in the same block formatting context (BFC)
const makesBfc = (e) => { const s = getComputedStyle(e); return e === document.documentElement || s.float !== 'none' || /absolute|fixed/.test(s.position) || !/visible|clip/.test(s.overflowX + s.overflowY) && s.overflow !== 'visible' || /inline-block|flow-root|table-cell|table-caption|flex|grid/.test(s.display) || (e.parentElement && /flex|grid/.test(getComputedStyle(e.parentElement).display)); };
const bfcOf = (e) => { for (let p = e; p; p = p.parentElement) if (makesBfc(p)) return p; return document.documentElement; };
const floats = [...document.querySelectorAll('body *')].filter((e) => { const s = getComputedStyle(e); return (s.float === 'left' || s.float === 'right') && visible(e); })
.map((e) => ({ el: e, bfc: bfcOf(e.parentElement), side: getComputedStyle(e).float, box: () => { const q = e.getBoundingClientRect(), s = getComputedStyle(e); return { left: q.left - parseFloat(s.marginLeft), right: q.right + parseFloat(s.marginRight), top: q.top - parseFloat(s.marginTop), bottom: q.bottom + parseFloat(s.marginBottom) }; } }));
const seen = new Set();
const tw = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
while (tw.nextNode()) {
const n = tw.currentNode;
if (!n.textContent.trim()) continue;
const el = n.parentElement;
if (!el || ['SCRIPT', 'STYLE', 'NOSCRIPT'].includes(el.tagName) || !visible(el)) continue;
let block = el; while (block && getComputedStyle(block).display === 'inline') block = block.parentElement;
if (!block || seen.has(block)) continue; seen.add(block);
const bs = getComputedStyle(block), br = block.getBoundingClientRect();
if (br.width < 1 || br.right < 0 || br.left > innerWidth) continue; // off-screen (e.g. hidden menu items)
const rg = document.createRange(); rg.selectNodeContents(block); const tr = rg.getBoundingClientRect();
const ts = getComputedStyle(el);
const lh = parseFloat(ts.lineHeight) || parseFloat(ts.fontSize) * 1.2;
const rects = [...rg.getClientRects()].filter((q) => q.width > 0);
const firstLine = rects.length ? rects[0] : tr;
// a glyph rect is the font's content area, centred on its line box
const lineTop = Math.round((firstLine.top + scrollY + (firstLine.height - lh) / 2) * 10) / 10;
// ---- rich HTML, line runs (floats) and occlusion -------------------------------
const hex = (c) => { const m = c.match(/\d+(\.\d+)?/g); if (!m) return c; const [r, g, b, a] = m.map(Number); const h = '#' + [r, g, b].map((v) => v.toString(16).padStart(2, '0')).join('').toUpperCase(); return a !== undefined && a < 1 ? `rgba(${r},${g},${b},${a})` : h; };
const escT = (t) => t.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\u00a0/g, ' ');
const inBlock = (n) => { for (let p = n.parentElement; p && p !== block; p = p.parentElement) if (!/^inline/.test(getComputedStyle(p).display)) return false; return true; };
// the BASE style is the one most characters are painted in; every other run becomes a flat
// <span style> relative to it (sizes in em), links stay <a>, nested blocks are their own entry
const runKey = (c) => [c.color, c.fontWeight, c.fontStyle, c.textDecorationLine, c.fontFamily, c.fontSize].join('|');
const counts = new Map(); const twc = document.createTreeWalker(block, NodeFilter.SHOW_TEXT);
while (twc.nextNode()) { const tn = twc.currentNode; if (!tn.textContent.trim() || !inBlock(tn)) continue; const c = getComputedStyle(tn.parentElement); const k = runKey(c); const e = counts.get(k) || { n: 0, el: tn.parentElement }; e.n += tn.textContent.trim().length; counts.set(k, e); }
const baseEl = counts.size ? [...counts.values()].sort((x, y) => y.n - x.n)[0].el : el;
const base = getComputedStyle(baseEl);
const diff = (cs) => { const st = [];
if (cs.color !== base.color) st.push(`color:${hex(cs.color)}`);
if (cs.fontWeight !== base.fontWeight) st.push(`font-weight:${cs.fontWeight}`);
if (cs.fontStyle !== base.fontStyle) st.push(`font-style:${cs.fontStyle}`);
if (cs.textDecorationLine !== base.textDecorationLine) st.push(`text-decoration:${cs.textDecorationLine}`);
if (cs.fontFamily !== base.fontFamily) st.push(`font-family:${cs.fontFamily.replace(/"/g, "'")}`);
if (cs.fontSize !== base.fontSize) st.push(`font-size:${(parseFloat(cs.fontSize) / parseFloat(base.fontSize)).toFixed(3)}em`);
return st.join(';'); };
const rich = (node, R) => {
let o = '';
for (const n of node.childNodes) {
if (R && !R.intersectsNode(n)) continue;
if (n.nodeType === 3) { const t = n.textContent; const s0 = R && n === R.startContainer ? R.startOffset : 0; const e0 = R && n === R.endContainer ? R.endOffset : t.length;
const w = escT(t.slice(s0, e0).replace(/[\n\t ]+/g, ' ')); const d = w.trim() ? diff(getComputedStyle(n.parentElement)) : ''; o += d ? `<span style="${d}">${w}</span>` : w; continue; }
if (n.nodeType !== 1) continue;
const tag = n.tagName; if (['IMG', 'SCRIPT', 'STYLE', 'NOSCRIPT', 'SVG', 'IFRAME'].includes(tag)) continue;
if (tag === 'BR') { o += '<br>'; continue; }
const cs = getComputedStyle(n); if (cs.display === 'none' || !/^inline/.test(cs.display)) continue;
const inner = rich(n, R);
o += tag === 'A' && n.getAttribute('href') ? `<a href="${n.href}">${inner}</a>` : inner;
}
return o;
};
const tidy = (h) => h.replace(/^(\s| |<br>)+|(\s| |<br>)+$/g, '');
const bcs = getComputedStyle(block);
// one entry per visual line: where it starts (text node + offset), its left and top
const lineStarts = []; const tw2 = document.createTreeWalker(block, NodeFilter.SHOW_TEXT);
const lhB = parseFloat(bcs.lineHeight) || parseFloat(bcs.fontSize) * 1.2;
while (tw2.nextNode()) { const tn = tw2.currentNode; if (!inBlock(tn)) continue; const rr = document.createRange();
for (let i = 0; i < tn.textContent.length; i++) { if (/\s/.test(tn.textContent[i])) continue; rr.setStart(tn, i); rr.setEnd(tn, i + 1); const q = rr.getBoundingClientRect(); if (!q.width) continue;
const last = lineStarts[lineStarts.length - 1]; if (!last || q.top > last.top + lhB / 2) lineStarts.push({ node: tn, offset: i, left: q.left, top: q.top, h: q.height }); } }
let segments = null;
// image replacement (text-indent:-9999px etc.): the words are not painted, the box is a click area
const hiddenText = lineStarts.length > 0 && (lineStarts[0].left > br.right + 50 || lineStarts[0].left < br.left - 50);
const leftAligned = /^(start|left|justify)$/.test(bcs.textAlign) && bcs.direction !== 'rtl';
if (!hiddenText && leftAligned && lineStarts.length) {
// the space each line wraps in: the block's content box minus every float beside the line
const contentLeft = br.left + parseFloat(bcs.paddingLeft) + parseFloat(bcs.borderLeftWidth);
const contentRight = br.right - parseFloat(bcs.paddingRight) - parseFloat(bcs.borderRightWidth);
for (const l of lineStarts) {
l.availL = contentLeft; l.availR = contentRight;
const myBfc = makesBfc(block) ? block : bfcOf(block);
// a float pushes only the lines that come after it in the document
for (const fl of floats) { if (fl.el.contains(block) || fl.bfc !== myBfc || !(fl.el.compareDocumentPosition(l.node) & Node.DOCUMENT_POSITION_FOLLOWING)) continue; const q = fl.box(); if (q.bottom <= l.top + 1 || q.top >= l.top + lhB - 1) continue;
if (fl.side === 'left' && q.right > l.availL && q.left < contentRight) l.availL = Math.max(l.availL, q.right);
if (fl.side === 'right' && q.left < l.availR && q.right > contentLeft) l.availR = Math.min(l.availR, q.left); }
}
const groups = []; for (const l of lineStarts) { const g = groups[groups.length - 1]; if (g && Math.abs(g.availL - l.availL) < 4 && Math.abs(g.availR - l.availR) < 4) g.lines.push(l); else groups.push({ availL: l.availL, availR: l.availR, left: l.left, lines: [l] }); }
// runs of lines that wrap in different spaces (floats beside some lines), or a single run narrowed by a float
if (groups.length > 1 || groups[0].availL > contentLeft + 4 || groups[0].availR < contentRight - 4) {
segments = groups.map((g, gi) => { const R = document.createRange(); if (gi === 0) R.setStart(block, 0); else R.setStart(g.lines[0].node, g.lines[0].offset);
if (gi < groups.length - 1) R.setEnd(groups[gi + 1].lines[0].node, groups[gi + 1].lines[0].offset); else R.setEnd(block, block.childNodes.length);
const f = g.lines[0]; const x = Math.round(g.availL);
return { rich: tidy(rich(block, R)), lineTop: Math.round((f.top + scrollY + (f.h - lhB) / 2) * 10) / 10, box: { x, y: Math.round(f.top + scrollY + (f.h - lhB) / 2), w: Math.round(g.availR) - x, h: Math.round(g.lines.length * lhB) }, lines: g.lines.length };
});
}
}
let occluded = false;
if (lineStarts.length) { // scroll the line into view, ignore floating (fixed) layers, test what is on top
const f = lineStarts[0]; const sy = scrollY; const absTop = f.top + sy; scrollTo(0, Math.max(0, absTop - 300));
const fixedUp = (e) => { for (let p = e; p; p = p.parentElement) if (getComputedStyle(p).position === 'fixed') return true; return false; };
const right = Math.min(br.right, f.left + tr.width) - 4; // sample the first line at three points: hidden only if all are covered
occluded = [f.left + 4, (f.left + right) / 2, right].every((x) => { const hit = document.elementsFromPoint(x, absTop - scrollY + f.h / 2).find((e) => !fixedUp(e)); return !!hit && hit !== block && !block.contains(hit); });
scrollTo(0, sy); }
texts.push({
rich: tidy(rich(block, null)), segments, occluded, hiddenText,
lines: lineStarts.length, linePitch: lineStarts.length > 1 ? Math.round(((lineStarts[lineStarts.length - 1].top - lineStarts[0].top) / (lineStarts.length - 1)) * 10) / 10 : null,
text: block.innerText.replace(/\s+\n/g, '\n').trim().slice(0, 400),
html: block.innerHTML.replace(/\s+/g, ' ').trim().slice(0, 600),
explicitBreaks: block.querySelectorAll('br').length,
// the painted WORDS only (inline images excluded): single-line boxes are sized and centred on it
glyphBox: (() => { let l = 1e9, t = 1e9, r = -1e9, b = -1e9; const tw3 = document.createTreeWalker(block, NodeFilter.SHOW_TEXT); while (tw3.nextNode()) { const tn = tw3.currentNode; if (!tn.textContent.trim() || !inBlock(tn)) continue; const rr = document.createRange(); rr.selectNodeContents(tn); for (const q of rr.getClientRects()) { if (!q.width) continue; l = Math.min(l, q.left); t = Math.min(t, q.top); r = Math.max(r, q.right); b = Math.max(b, q.bottom); } } return l < 1e9 ? { x: Math.round(l), y: Math.round(t + scrollY), w: Math.round(r - l), h: Math.round(b - t) } : null; })(),
// the first painted glyph line sets lineTop (an inline image on the first line must not)
block: R(br), textBox: R(tr), lineTop: lineStarts.length && !hiddenText ? Math.round((lineStarts[0].top + scrollY + (lineStarts[0].h - lhB) / 2) * 10) / 10 : lineTop,
padding: [bs.paddingTop, bs.paddingRight, bs.paddingBottom, bs.paddingLeft].join(' '),
font: base.fontFamily, size: base.fontSize, weight: base.fontWeight, style: base.fontStyle, color: base.color,
lineHeight: base.lineHeight, letterSpacing: base.letterSpacing, transform: base.textTransform, align: bs.textAlign,
decoration: base.textDecorationLine, shadow: base.textShadow,
links: [...new Set([...block.querySelectorAll('a')].map((a) => a.href).concat(block.closest('a') ? [block.closest('a').href] : []))],
});
}
const walk = (root) => { for (const e of root.querySelectorAll('*')) { const s = getComputedStyle(e); if (s.position === 'fixed' && visible(e)) {
// report the clickable child (the visible pill), not a full-width wrapper
const t = e.matches('a,button') ? e : (e.querySelector('a,button') || e);
const ts = getComputedStyle(t), r = t.getBoundingClientRect();
fixed.push({ tag: t.tagName, cls: String(t.className || '').slice(0, 80), box: { x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), h: Math.round(r.height) }, bottomOffset: Math.round(innerHeight - r.bottom), text: (t.innerText || '').trim().slice(0, 120), href: t.href || null, background: ts.backgroundColor, radius: ts.borderRadius, padding: ts.padding, font: ts.fontFamily, size: ts.fontSize, weight: ts.fontWeight, color: ts.color });
} if (e.shadowRoot) walk(e.shadowRoot); } };
walk(document);
// every visible link, with its box: build-description turns each one the text and image links do not
// already cover into a transparent click area, so no source link is lost (icons, logo, nav, tiles)
const anchors = [];
for (const a of document.querySelectorAll('a[href]')) {
const h = a.getAttribute('href') || ''; if (!h || h.startsWith('#') || /^javascript:/i.test(h) || !visible(a)) continue;
const r = a.getBoundingClientRect(); if (r.width < 4 || r.height < 4) continue;
anchors.push({ href: a.href, text: ((a.innerText || '').trim().replace(/\s+/g, ' ') || a.getAttribute('aria-label') || (a.querySelector('img') && a.querySelector('img').alt) || '').slice(0, 60), box: { x: Math.round(r.x + scrollX), y: Math.round(r.y + scrollY), w: Math.round(r.width), h: Math.round(r.height) } });
}
return { anchors, height: Math.max(document.documentElement.scrollHeight, document.body.scrollHeight, Math.round(document.body.getBoundingClientRect().bottom + scrollY)) /* the full scrollable page, body margins included */, backgrounds, images, texts, fixed, unsupported };
});
await page.close();
return data;
}
const main = await measure(width);
const wide = await measure(width + 640);
const dx = wide.images.map((im, i) => (main.images[i] ? im.box.x - main.images[i].box.x : null)).filter((v) => v != null);
const centered = dx.length > 0 && dx.every((v) => v === dx[0]);
const result = { url, width, measuredAt: new Date().toISOString(), page: { height: main.height, centeringDx: [...new Set(dx)], centered, offsetAtPlusWidth: centered ? dx[0] : null }, ...main };
fs.writeFileSync(out, JSON.stringify(result, null, 1));
await browser.close();
console.log(JSON.stringify({ out, height: main.height, centered: result.page.centered, centeringDx: result.page.centeringDx, backgrounds: main.backgrounds.length, images: main.images.length, texts: main.texts.length, fixed: main.fixed.length }));
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Wix
- Publisher
- Wix (Official)
- Source
- wix/skills · skills/wix-harmony-editor · commit d168bc2
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Wix.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wix-harmony-editor.zip