Metadata-Version: 2.4
Name: scic-webgui
Version: 0.2.0
Summary: Ready-to-use generic web application client for SCIC Framework
Author: Specter
License-Expression: MIT
Project-URL: Homepage, https://github.com/specter327/scic-webgui
Project-URL: Repository, https://github.com/specter327/scic-webgui
Project-URL: Issues, https://github.com/specter327/scic-webgui/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: scic-framework<0.3.0,>=0.2.3
Requires-Dist: fastapi<1.0,>=0.115
Requires-Dist: uvicorn[standard]<1.0,>=0.30
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
Requires-Dist: httpx>=0.27; extra == "test"
Requires-Dist: pytest-cov>=5.0; extra == "test"
Provides-Extra: build
Requires-Dist: build>=1.2; extra == "build"
Requires-Dist: twine>=5.0; extra == "build"
Dynamic: license-file

# scic-webgui 0.2.0

Adaptive and extensible WebGUI for `scic-framework`.

The library provides a complete application shell automatically, while allowing applications to replace individual input controls, result renderers, or complete resource views without changing SCIC or business services.

## Capabilities

- Responsive desktop/mobile application shell.
- Navigation generated from the SCIC resource tree.
- Adaptive forms for text, numbers, booleans, secrets, selections, JSON, and files.
- Drag-and-drop JSON/text files.
- Structured results: tables, property grids, lists, primitive values, and optional raw JSON.
- Confirmation for destructive operations through SCIC metadata.
- Light/dark theme packages.
- Browser extension API for specialized interfaces.
- FastAPI application ready to mount or serve.

## Basic use

```python
from scic_webgui import SCICWebGUI, WebGUIConfig

webgui = SCICWebGUI(
    scic,
    WebGUIConfig(
        application_name="OpenShell Manager",
        application_description="OSAM administrative interface",
        default_variant="dark",
    ),
)

app = webgui.app
```

## Semantic metadata

```python
metadata={
    "title": "Import Root Authority",
    "category": "Trust",
    "icon": "◈",
    "submit_label": "Import",
}
```

Parameter:

```python
metadata={
    "label": "Public profile",
    "input_kind": "json-file",
    "accepted_extensions": [".json"],
}
```

Destructive operation:

```python
metadata={
    "danger": "destructive",
    "confirmation_required": True,
}
```

## Specialized extensions

Configure ES modules:

```python
WebGUIConfig(
    extension_scripts=("/static/osam-webgui.js",),
)
```

Register a result renderer:

```javascript
SCICWebGUI.registerResultRenderer(
  ({ resource, value }) =>
    resource?.path.endsWith("/services/list") && Array.isArray(value),
  ({ value }) => `<div class="service-list">...</div>`,
  100,
);
```

Register an input renderer:

```javascript
SCICWebGUI.registerInputRenderer(
  ({ metadata }) => metadata.format === "uuid",
  ({ index }) => `<input class="control" name="arg-${index}" pattern="[0-9a-f-]+">`,
  100,
);
```

Replace a complete command view:

```javascript
SCICWebGUI.registerView(
  "/osam/root-authority/list",
  async ({ resource, api, mount }) => {
    const response = await api("/invoke", {
      method: "POST",
      body: JSON.stringify({ path: resource.path, arguments: [] }),
    });
    mount.innerHTML = `<section>...</section>`;
  },
);
```

The generic renderer remains available as a fallback for every uncustomized resource.

## Development

```bash
./check.sh
```
