# Changelog

All notable changes to `@webflow/page-client` are documented here.

---

## [0.0.9] - 2026-04-02

### Designer Extension API changes

#### Components
- **New** `component.getSettings()` — retrieve component-level settings.
- **New** `component.getVariants()` — list all variants defined on a component.
- **New** `component.getVariant(variantId)` — retrieve a single variant by ID (including `'base'`).
- **New** `component.setVariant(variantId, settings)` — update variant settings (e.g. rename).
- **New** `component.createVariant(options)` — create a new variant, optionally by duplicating an existing one (including the base variant).
- **New** `component.setSelectedVariant(options)` — programmatically select a variant for editing by name or ID.
- **New** `component.subscribe('selectedvariant', callback)` — react to variant selection changes in real time.
- **New** `component.getDisplayName()` / `component.setDisplayName(name)` — read and write the human-readable component name.
- **New** `webflow.getComponent(id)` — retrieve a component by its ID.
- **New** `webflow.getComponentByName(name)` — retrieve a component by its display name.
- **New** `webflow.getCurrentComponent()` — get the component currently open for editing.
- **New** `webflow.searchComponents(options)` — full-text search across component names and descriptions.
- **Enhanced** `webflow.registerComponent(options)` — now supports metadata and replacement of existing components.
- **New** `element.getParentComponent()` — find which component definition contains a given element.
- **New** `element.getSlots()` — list slots on `ComponentElement` and `SlotInstanceElement`.
- **New** `webflow.elementPresets.Slot` — insert Slot elements into components programmatically.

#### Component Instance Props
- **New** `instance.searchProps(options)` — inspect all props on a component instance with full metadata including binding source details (CMS, locale, page, conditional, and parent-prop bindings) and resolved values.
- **New** `instance.getProps()` — get raw prop values and override status without full metadata.
- **New** `instance.getResolvedProps()` — get final resolved prop values after all bindings are evaluated.
- **New** `instance.setProps(props)` — set static prop values on a component instance.
- **New** `instance.resetAllProps()` — remove all prop overrides, resetting every prop to its component default.

#### Data Binding
- **Enhanced** `webflow.searchBindableSources(options)` — now returns all data source types (CMS fields, page settings, locale fields, and component props) in a single call, not just component props.

#### Pages & Navigation
- **New** Branch navigation and discovery APIs on the Page object — navigate and list branches from within a Designer Extension.
- **New** `webflow.openCanvas(options)` — open a page or component in the Designer canvas programmatically.
- **New** `PageSlot` is now exposed as a supported element type in the DE API.

#### Site Info
- **New** `getSiteInfo()` now includes a `kind` field indicating the type of site (e.g. standard, template).

#### Elements
- **Enhanced** Element insertion APIs now accept HTML tag strings (e.g. `'section'`, `'article'`) in addition to element presets.
- **Fixed** Custom element creation by tag now validates against Designer rules, preventing invalid tag usage.

#### App Mode Notifications
- **New** Enriched `currentappmode` subscription with mode-specific data and new query APIs, enabling extensions to react to app mode changes with detailed context.
- **New** Mode-specific error classification and client-side guards for app mode transitions.

### Package changes
- Added `CHANGELOG.md` to the published package — release notes are now included in every npm tarball.
- Page-client now sends its version via `x-page-client-version` header during connection, enabling the server to reject incompatible minor versions.
- Designer Extension abilities are now enabled on branches (not just main sites).
- Removed Designer-specific APIs from the `PageClient` surface — `PageClient` now only exposes the subset of APIs relevant to headless page sessions.

---

## [0.0.8] - 2026-03-09

### Designer Extension API changes
- **New** `Component.getInstanceCount()` — returns how many times a component is used across the site, enabling auditing and safe-deletion workflows.
- **New** `webflow.registerComponent(options)` overload — create a blank component without needing an existing element or preset, matching the "Create blank" action in the Designer UI.
- **Removed** Memberships-related element presets from the API surface — Memberships has been deprecated and those elements can no longer be added via DE APIs.

### Package changes
- `AI_USAGE.md` is now included in the published package files.

---

## [0.0.7] - 2026-02-27

### Designer Extension API changes
- **New** `element.getWHTML()` — converts WFDL elements to WHTML strings, useful for LLM-based workflows that operate on large chunks of page content.
- **New** `insertElementFromWHTML(whtml, anchor, position)` — parses a WHTML string and inserts the resulting element at a specified position relative to an anchor element. Automatically handles style blocks and CSS variables.
- **Enhanced** Style DE APIs (`setProperty` / `setProperties`) now accept any valid CSS property, not just the ~280 explicitly allow-listed ones. Properties such as `aspect-ratio` and `container-type` are now supported.
- **Fixed** Style panel now reflects changes made through DE style API calls.

### Package changes
- Added `.gitignore` to exclude the `dist/` directory from version control.
- Clarified publishing instructions in the README.

---

## [0.0.6] - 2026-02-04

### Designer Extension API changes
- **Enhanced** `getStyleByName()` now accepts an array of names to resolve nested styles by path (e.g. `getStyleByName(['grandparent', 'parent', 'child'])`), allowing deterministic lookup when multiple styles share the same name.
- **New** `BlockElementTags` constants — shared constants and types for block element tags, used to improve type-safety across tag getter/setter APIs.

### Fixed
- Bumped runtime token version to fix a client/server version mismatch that was causing MPS connections to fail.

---

## [0.0.5] - 2026-02-03

### Fixed
- `PageClient` now retries fetching MPS connection details when the previous server instance becomes unavailable, improving resilience during server transitions.

---

## [0.0.4] - 2026-02-03

### Designer Extension API changes
- **New** `Style.getParentStyle()` — returns the parent style of a combo class child style, or `null` if none exists.

### Added
- `featureFlags` option in `PageClientConfig` — pass `{ on: [...], off: [...] }` to override feature flags for the page session.
- `AI_USAGE.md` documenting how to use the library with AI assistants.

### Changed
- `csstree-validator` is now an external dependency (not bundled), matching the same treatment applied to `css-tree` in 0.0.3.
- Connection now waits for MPS to spin up before timing out.
- Updated license headers across package files.

---

## [0.0.3] - 2025-12-11

### Fixed
- `css-tree` is now declared as an external dependency rather than being bundled, resolving an absolute-path issue at runtime ([upstream issue](https://github.com/csstree/csstree/issues/314)).

---

## [0.0.2] - 2025-12-11

### Changed
- Publishing workflow updated to use personal NPM accounts instead of webflow-bot credentials.

---

## [0.0.1] - 2025-12-10

### Added
- Initial release of `@webflow/page-client` — a standalone SDK for working with Webflow pages using Designer Extension APIs without a running Designer instance.
- `PageClient` class with `connect()` method for establishing a session with the Multiplayer Server.
- Full Designer Extension API v2 surface exposed via the `webflow` global, including elements, styles, pages, variables, and components.
- Socket.io-based connection to Webflow's Multiplayer Server with support for verbose logging.
