# XWUIFormDesigner

Reusable form-authoring coordinator. Compose `XWUIFormListComponents`,
`XWUIFormCanvas`, `XWUIFormItemProperties` and `XWUIFormJsonEditor` independently,
or use this component for the complete designer.

```ts
const designer = new XWUIFormDesigner(host, { formDefinition }, {
  locale: 'ar',
  resolveComponent: id => XWUI.get(id),
  validate: document => validateHostContract(document),
});
designer.onChange(document => saveWithWorkspaceRevision(document));
```

`getFormComponentCatalog()` supplies input, display and layout metadata generated
from Basic, Power and Super descriptors. The palette searches the complete catalog;
it initially renders 60 results, with Show more, to avoid hundreds of controls on
phones. Component implementations load only when placed on the canvas. The native
loader remains responsible for entitlement, origin and version checks. Components
requiring an external service still require that service's host configuration.

The document retains pages/sections, rows/columns, widths, component identity and
separate schema-backed `data` and `config` bags. Layouts with the native
`preservesChildren` capability can contain designer items; layouts with their own
steps/items use those schema properties. Adding a page sets presentation to
`wizard`. Nested items, pages and settings round trip through JSON. The inspector
uses native XWUI inputs, selects for enums, checkboxes for booleans, and bounded
JSON values for arrays/objects. VIEW and JSON share one validated model; an invalid
JSON draft survives switching tabs without changing the document.

Read-only blocks structural edits, property changes and JSON application. JSON is
data only: unknown component names/properties, duplicate IDs, invalid property
types/enums, prototype keys, excessive nesting and oversized documents are rejected
before replacement. Hosts must also validate their domain, service and security
requirements. `entries` can restrict the palette to a host's supported catalog.

The shared component does not own accounts, persistence, publication or AI calls. Hosts adapt validated documents through their domain/server boundary; product release checks attest deployment.

`item.form` owns common form semantics independently of native component configuration: localized `labels` and `help`, `required`, and optional numeric/selection `min` and `max`. XWUIFormItemProperties edits these settings even when a native control exposes no label or required flag. Native input rendering receives the form-level label and requirement where supported; other controls receive a projected XWUI label. JSON keeps both the native properties and this wrapper contract, preserving required questions and consent during migration.

Set `locales: ["ar", "en"]` to expose schema-validated translation overrides in the inspector. Translations are native property paths, for example `translations.ar["data.label"]`; rendering applies only the selected locale. Switching locale rebuilds panel hosts safely on native, React, Vue and Preact. JSON drafts retain their base document and reject stale application after a visual or server change; Reset reloads the latest document. Duplicate remaps nested IDs; Undo retains a bounded 20-edit history. The catalog initially paints 24 entries; search and Show more expose the full inventory.
