Metadata-Version: 2.4
Name: nativehtmlkit-demo
Version: 0.1.1
Summary: Browse and run the NativeHTMLKit examples: one window with the HTML, CSS, Python and PowerShell source of each example and a Run button
Author: NativeHTMLKit contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/nativehtmlkit/nativehtmlkit-demo
Project-URL: Documentation, https://nativehtmlkit.github.io/
Project-URL: Issues, https://github.com/nativehtmlkit/nativehtmlkit-demo/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Environment :: X11 Applications
Classifier: Environment :: Win32 (MS Windows)
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nativehtmlkit<0.2.0,>=0.1.2
Requires-Dist: nativehtmlkit_ui<0.2.0,>=0.1.1
Dynamic: license-file

# NativeHTMLKit Demo

One window with every NativeHTMLKit example. Pick an example, read its **Python**, **PowerShell**,
**HTML** and **CSS** source, and press **Run Python** or **Run PowerShell** to start it as its own
native desktop app. No browser, no web server.

![The NativeHTMLKit Demo window on KDE Plasma (Wayland), with the Counter example started from it](https://raw.githubusercontent.com/nativehtmlkit/nativehtmlkit-demo/v0.1.1/docs/images/demo-linux.png)

NativeHTMLKit renders HTML and CSS in a native window and drives it from Python or PowerShell. See
the [documentation](https://nativehtmlkit.github.io/).

## Install and start

**Python**, with [uv](https://docs.astral.sh/uv/getting-started/installation/) (uv provides Python 3.10 or later if needed):

```bash
uvx nativehtmlkit-demo                    # run it without installing
uv tool install nativehtmlkit-demo        # or install the command
nativehtmlkit-demo
```

**PowerShell** (7.x, or Windows PowerShell 5.1):

```powershell
Install-Module NativeHTMLKit.Demo -Scope CurrentUser
Start-NativeHTMLKitDemo
```

Each package contains the launcher and all the examples. The Python package installs the
`nativehtmlkit` SDK and `nativehtmlkit_ui`; the PowerShell module installs the `NativeHTMLKit` and
`NativeHTMLKit.UI` modules. To run the examples of the other language as well, install that
language's package too. The launcher finds Python and PowerShell on `PATH` and tells you what is
missing.

Supported platforms are those of the SDKs: Linux (KDE Plasma on Wayland is the primary desktop)
and Windows 10/11 or Server 2022, x64.

## What is in the window

- **Examples** on the left, each with a one-line summary. **All / SDK / UI** narrows the list to
  the SDK examples (direct HTML/CSS plus events) or the NativeHTMLKit UI examples (reactive
  components), with the number of matches; the filter box searches titles, summaries and topics.
  **Up/Down** moves through the list (also from the filter box), **Esc** clears the filter.
- **Source tabs** (always dark): **Python** and **PowerShell** show the code only, with the
  page's HTML and CSS left to their own tabs; **Full script** shows the single file exactly as it
  ships. **HTML** and **CSS** show the page: for SDK examples the page embedded in the code or
  loaded from `index.html`, for UI examples the markup NativeHTMLKit UI generates for the first
  render.
- **Run Python / Run PowerShell** start the example in a new process. Examples run from a working
  folder under your temporary directory (`nativehtmlkit-demo/`). The log viewer gets a sample log
  file that grows while it runs.
- **Running examples** at the bottom: Stop, or open the **Output** tab to see what an example
  printed and why it exited.

The examples come from the
[Python SDK](https://github.com/nativehtmlkit/nativehtmlkit-python/tree/main/examples),
[PowerShell SDK](https://github.com/nativehtmlkit/nativehtmlkit-powershell/tree/main/examples) and
[NativeHTMLKit UI](https://github.com/nativehtmlkit/nativehtmlkit_ui/tree/main/examples) repositories.
Their guides explain each one.

## Self-test

`nativehtmlkit-demo --self-test` (or `uvx nativehtmlkit-demo --self-test`) and `Start-NativeHTMLKitDemo -SelfTest` run the launcher
headless, check every example and its source tabs, start a few examples in each installed language
and stop them again. They print `PASS`/`FAIL`/`SKIP` lines and exit with code 0 when nothing failed.

## Development

```bash
python scripts/sync_examples.py      # copy the examples from sibling SDK/UI checkouts, write content/catalog.json
python -m pytest tests               # content checks
PYTHONPATH=python/src python -m nativehtmlkit_demo          # run from the checkout
pwsh -File powershell/NativeHTMLKit.Demo/Demo.ps1            # (needs the NativeHTMLKit modules)
python scripts/build.py              # dist/: wheel, module zip, SHA256SUMS
```

`content/examples/` is generated; change an example in its own repository, then sync again.

## License

MIT. The examples keep the licenses of their repositories (copies in `content/examples/LICENSES/`).
