|
# NewLife.Cube.Svelte - SvelteKit 2 + Svelte 5 + Tailwind CSS 4 skin for NewLife.Cube



<!-- lang:start -->
🌐 [简体中文](/NewLife/NewLife.Cube.Svelte/Blob/master/README.zh-CN.md) | [繁體中文](/NewLife/NewLife.Cube.Svelte/Blob/master/README.zh-TW.md) | [Español](/NewLife/NewLife.Cube.Svelte/Blob/master/README.es.md) | [Deutsch](/NewLife/NewLife.Cube.Svelte/Blob/master/README.de.md) | [日本語](/NewLife/NewLife.Cube.Svelte/Blob/master/README.ja.md) | [Français](/NewLife/NewLife.Cube.Svelte/Blob/master/README.fr.md) | [Português](/NewLife/NewLife.Cube.Svelte/Blob/master/README.pt.md) | [Русский](/NewLife/NewLife.Cube.Svelte/Blob/master/README.ru.md) | [한국어](/NewLife/NewLife.Cube.Svelte/Blob/master/README.ko.md) | [العربية](/NewLife/NewLife.Cube.Svelte/Blob/master/README.ar.md)
<!-- lang:end -->
The **Svelte skin** for the third-generation Web API front end of Cube (NewLife.Cube), delivered as a standalone NuGet package and repository. Built with **SvelteKit 2 + Svelte 5 + Tailwind CSS 4**, it renders metadata-driven lists and forms and follows the Cube skin design specification.
## Highlights
- Out of the box: reference the NuGet package, run `AddCube` + `UseCube`, and the embedded admin console is ready; no physical front-end files are required.
- Metadata driven: lists, forms, search and detail pages are rendered from backend `meta`; adding an entity needs no front-end work.
- Shared npm core: uses `@newlifex/cube` for API, page logic, field mapping and auth; the framework-agnostic core is shared by all Cube skins.
- Skin switching: Cube auto-discovers referenced skin packages; switch with the `SpaSkin` setting.
- Feature parity with Cube.Vue / Cube.React: sign-in (captcha, MFA, tenant, OAuth), registration, password recovery, account activation, workbench, account center (profile/security), tree tables, column settings, import/export, developer actions, menu search (Ctrl+K), multi-tab navigation, theming and UI language.
- AI assistant: floating launcher and chat panel with SSE streaming (`POST /Ai/AiChat`), tool-call cards, Markdown/Mermaid rendering, `run_js` round-trip and AI form filling.
- Two test layers: Vitest for utility modules and AI protocol safety, Playwright for sign-in, navigation, entity CRUD, config pages, account center, list enhancements and the AI panel.
## Documentation
- [Requirements (zh-CN)](/NewLife/NewLife.Cube.Svelte/Blob/master/Doc/需求文档.md)
- [Feature list (zh-CN)](/NewLife/NewLife.Cube.Svelte/Blob/master/Doc/功能清单.md)
- [Architecture (zh-CN)](/NewLife/NewLife.Cube.Svelte/Blob/master/Doc/架构设计.md)
- [Multi-language README guide (zh-CN)](/NewLife/NewLife.Cube.Svelte/Blob/master/Doc/README多语言规范.md)
## Quick Start
Reference `NewLife.Cube` and `NewLife.Cube.Svelte`, then start the host:
```bash
dotnet add package NewLife.Cube
dotnet add package NewLife.Cube.Svelte
```
```csharp
services.AddCube();
var app = builder.Build();
app.UseCube(app.Environment);
app.MapControllers();
app.Run();
```
## Local Development
Start the demo backend and the Vite dev server:
```bash
# backend (SQLite, http://localhost:7125)
dotnet run --project CubeDemo/SvelteCubeDemo.csproj
# frontend (http://localhost:5186)
cd NewLife.Cube.Svelte/web
pnpm install
pnpm dev
```
### Local boundary channel
.NET: `dotnet build 魔方Svelte.slnx -p:UseLocalNewLifeSource=true` uses the sibling `../NewLife.Cube` source. npm: `pnpm link:local` / `pnpm unlink:local` switches to `../NewLife.Cube/packages/cube` and back.
## Build and Test
Build the web assets, run checks and pack the NuGet package:
```bash
cd NewLife.Cube.Svelte/web
pnpm build
pnpm test:unit
dotnet build 魔方Svelte.slnx -c Release
dotnet pack NewLife.Cube.Svelte/NewLife.Cube.Svelte.csproj -c Release -o out
```
### E2E tests
The Playwright suite in `E2ETest/` covers every menu page plus CRUD, config, permission and navigation flows against the demo site.
```bash
# demo site on http://localhost:7125 (SQLite)
dotnet run --project CubeDemo/SvelteCubeDemo.csproj
cd E2ETest
pnpm install
pnpm exec playwright install chromium
pnpm test
```
Set `E2E_BASE_URL` (for example `http://localhost:7117`) to target another host/port, or `E2E_NO_WEBSERVER=1` when the site is already running. Admin credentials come from `ADMIN_USER` / `ADMIN_PASS` (default `admin` / `admin`).
## Release
CI builds the web assets, embeds `wwwroot` into the DLL, then packs and publishes `NewLife.Cube.Svelte` to NuGet.
## Related repositories
| Repository | Description |
| --- | --- |
| [NewLife.Cube](https://github.com/NewLifeX/NewLife.Cube) | Cube core, shared npm package `@newlifex/cube` and skin design specification. |
| [NewLife.Cube.React](https://github.com/NewLifeX/NewLife.Cube.React) | React skin (React 19 + Ant Design). |
| [NewLife.Cube.Svelte](https://github.com/NewLifeX/NewLife.Cube.Svelte) | Svelte 5 skin. |
| [NewLife.Cube.Soybean](https://github.com/NewLifeX/NewLife.Cube.Soybean) | Soybean Admin skin. |
## License
MIT
|