# UnifiedWriter Demo Guide

Demos are Host integration examples and are not product runtime code. Demo-only panels, local callbacks, explanations, and maximize controls stay under `demo/`.

## Demo files

- `index.html`: demo list.
- `basic.html`: basic Host embedding with Local OpenFile / SaveFile callbacks.
- `parameters.html`: parameter-specified demo. It separates the options panel from the Control display frame and supports a Demo-only maximize / restore mode for the frame.
- `callback-io.html`: logs OpenFile / SaveFile request and response flow.
- `oneeditor-integration.html`: shows a OneEditor-style Host profile that creates EditorControl, reads Command/Menu/Toolbar/File Capability contributions, and composes its own Host shell.
- `control-architecture.html`: Control API notes.
- `regression-tests.html`: lightweight manual regression checklist.

## Parameter demo policy

`parameters.html` follows the common development policy v1.6:

1. Major options can be specified from the screen before mounting the Control.
2. The options / connection settings panel and the Control display frame are clearly separated.
3. The Control display frame can be maximized to use the available page area.
4. Maximize / restore is implemented as Demo UI only and does not modify the product Control API or standard runtime layout.
5. Existing selected options and callback connection settings are preserved when restoring to normal view.

## HTTP server

Run demos from an HTTP server. Do not use `file://`.

## v5.66.2 UnifiedControl alias for demos

Because UnifiedWriter now depends on UnifiedControl as a peer AMD package, demos configure both `UnifiedControl` and `UnifiedWriter` RequireJS aliases.  The default demo lookup uses the internal development package root supplied for UnifiedControl:

```text
https://cdn.skylarkjs.com/itoolkits/developments/UnifiedControl/
```

Demo code derives the RequireJS alias `UnifiedControl` by appending `/scripts` to this package root.

A different development location can be supplied with the `ucRoot` query parameter, for example:

```text
demo/basic.html?ucRoot=https://cdn.skylarkjs.com/itoolkits/developments/UnifiedControl/
```

The demo parameter only affects the sample Host shell.  UnifiedControl is still a peer package and is not copied into this package.


## v5.67.0 demo CSS order

Demos now model the Host contract: fetch `PACKAGE_MANIFEST.json`, load `styles.required` and selected theme CSS, then create the Control. Direct `ih-shell.css` links are obsolete.


## v5.67.1 Demo File Save Policy Alignment

Demo SaveFile callbacks now follow the single-file policy v1.3 direction split: Workbench/Command obtains or generates a HostSavePayload/v1 with payload.data, then the Demo Host SaveFile callback writes that data by using a local-device download adapter. Demo code does not mark App Storage as the user-facing save destination and does not save without payload.data. Save As dialogs use the package overlay class `uwriter-floating-ui` so file-save UI remains scoped under the v1.10 CSS/Theme contract.


## dev-5.67.2 Demo Local Disk Save update

Demo pages now implement Host-side Local Disk file selection for OpenFile / SaveFile callbacks.  On browsers with the File System Access API, Open uses `showOpenFilePicker()` and Save / Save As uses `showSaveFilePicker()` plus writable file handles.  `HostSavePayload/v1.payload.data` is the only write source.  FileSaver/download is kept only as an unsupported-browser fallback.
