v0.1.0-skeleton: Tauri v2 + React + TS scaffold with design system

- Tauri v2 project with greet command (invoke round-trip verified)
- React + TypeScript + Vite front-end
- Tailwind CSS v4 with dark blue + gold design tokens
- Glassmorphism .glass-card component with backdrop-filter
- BentoCard component (framer-motion, lucide-react icons)
- App shell: left rail nav (56px) + title bar + bento grid dashboard
- Cinzel / Inter / JetBrains Mono font stack
- Dark-only design: #0a0e1a deep, #d4af37 gold accents
- All design tokens as CSS custom properties
- Rust backend: greet command, tauri-plugin-log
- Builds successfully: cargo check, tsc, vite build, tauri build (macOS .app + .dmg)
This commit is contained in:
itsamejms
2026-06-28 22:30:28 +01:00
commit f30a92ddeb
43 changed files with 8525 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Rust / Tauri
src-tauri/target/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+8
View File
@@ -0,0 +1,8 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
+32
View File
@@ -0,0 +1,32 @@
# React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the Oxlint configuration
If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`:
```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"options": {
"typeAware": true
},
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
```
See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories.
+13
View File
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DM-Pal</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+2122
View File
File diff suppressed because it is too large Load Diff
+33
View File
@@ -0,0 +1,33 @@
{
"name": "dm-pal",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "oxlint",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-log": "^2",
"framer-motion": "^12",
"lucide-react": "^0.525",
"react": "^19.2.7",
"react-dom": "^19.2.7"
},
"devDependencies": {
"@tailwindcss/vite": "^4",
"@tauri-apps/cli": "^2.11.4",
"@types/node": "^24.13.2",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.3",
"oxlint": "^1.69.0",
"tailwindcss": "^4",
"typescript": "~6.0.2",
"vite": "^8.1.0"
}
}
+842
View File
@@ -0,0 +1,842 @@
# AI-Powered Dungeon Master Toolkit
*A local, offline-first desktop app built with **Tauri v2** + **Rust** that gives you every tool a DM needs — all powered by a local LLM.*
> **TL;DR**
> 1. Scaffold a Tauri v2 project.
> 2. Add Rust bindings to a local LLM (`llama-cpp-2`, `llama_cpp`, or Candle).
> 3. Build modular "utilities" (World Builder, NPC Generator, Encounter Designer, etc.).
> 4. Wire them up in the front-end via `tauri.invoke` + Tauri Channels for streaming.
> 5. Package and ship — no internet required after first run.
---
## Table of Contents
1. [What a DM Needs](#1-what-a-dm-needs)
2. [System Architecture](#2-system-architecture)
3. [Quick Start — Boilerplate](#3-quick-start--boilerplate)
4. [Local LLM Integration](#4-local-llm-integration)
5. [Core Utilities & AI Features](#5-core-utilities--ai-features)
6. [Front-End Architecture (React/TS)](#6-front-end-architecture-reactts)
7. [Design System — Visual Language](#7-design-system--visual-language)
8. [UI/UX Feature Design](#8-uiux-feature-design)
9. [Data Persistence](#9-data-persistence)
10. [Model Management UX](#10-model-management-ux)
11. [Lore Search / RAG](#11-lore-search--rag)
12. [Security & Legal Considerations](#12-security--legal-considerations)
13. [Optional Enhancements](#13-optional-enhancements)
14. [Resources & Quick Links](#14-resources--quick-links)
15. [Development Checkpoints](#15-development-checkpoints)
16. [Final Checklist](#16-final-checklist)
---
## 1. What a DM Needs
| Category | Typical Items | AI-Powered Utility |
|----------|---------------|--------------------|
| **World & Setting** | Campaign bible, maps, lore notes | Auto-generate continents, history timelines, religions, backstory snippets |
| **NPCs & Factions** | Sheets for each character, relationships | Create NPC bios, personality traits, dialogue hooks, agenda charts, relationship webs |
| **Plot / Quests** | Story arcs, side quests, beats | Draft story outlines, branching choices, plot twists |
| **Encounters** | Enemy lists, terrain descriptions | Generate balanced combat encounters, environmental modifiers, loot tables |
| **Magic & Items** | Item descriptions, stats, rarity | Forge unique items with lore, backstory, and mechanical effects |
| **Maps** | Tile sets, hand-drawn maps | Render vector/raster terrain, city layouts; fog-of-war overlays |
| **Player Materials** | Character sheets, handouts | Auto-populate sheets from templates; generate handouts/flashcards |
| **Session Management** | Logbook, notes, schedule | Track session logs, note highlights, future hook suggestions |
| **Initiative / Combat Tracker** | Turn order, HP, conditions, round timer | Visual combat tracker with condition tracking |
| **Dice & RNG** | Physical dice | Simulate dice rolls, record outcomes; random table roller |
| **Rule Reference** | PHB, DMG, 5e SRD | Lookup rules (SRD/CC-BY content only), convert stats across editions |
| **Calendar & Weather** | Fantasy calendar, seasonal events | Custom calendar system with weather generation |
| **Soundboard / Ambience** | Audio clips | Local audio playback for tavern, combat, forest ambience |
| **Name Generators** | Fantasy, sci-fi, historical name banks | AI-powered or procedural name generation |
| **Puzzle / Trap Designer** | Skill-check flows, trap DCs, hints | Generate puzzle mechanics, trap stat blocks |
| **Homebrew Importer** | Custom classes, spells, monsters | Import from Markdown/JSON templates |
---
## 2. System Architecture
```
┌────────────────────────────────────┐
│ Front-End (TS / React) │
│ Tauri v2 WebView · Capabilities │
│ UI · Map Viewer · Dialog Editor │
│ Drag-and-Drop · File Explorer │
└───────────────▲────────────────────┘
invoke() / Channel
┌───────────────┴────────────────────┐
│ Rust Back-End (Tauri API) │
│ Business Logic · LLM Inference │
│ File I/O · Session Storage │
├───────────────▲────────────────────┤
│ │ │
│ llama-cpp-2 │ SQLite / JSON │
│ (local GGUF)│ Storage Layer │
└───────────────┴────────────────────┘
```
### Key Points
- **Offline-first**: Core LLM runs locally via GGUF. Remote API is optional for higher-capacity models.
- **Tauri v2 security**: UI runs in a sandboxed WebView; all file/system access gated by capability permissions.
- **Plug-in-style utilities**: Each tool is a separate feature flag — start with "World Builder", add "Encounter Designer" later.
- **Recommended Tauri plugins**:
| Plugin | Purpose |
|--------|---------|
| `tauri-plugin-store` | User settings, UI state, recent campaigns |
| `tauri-plugin-fs` | Read/write campaign JSON/Markdown files |
| `tauri-plugin-dialog` | Open/save dialogs for campaigns and maps |
| `tauri-plugin-sql` | SQLite for indexed NPC/location/loot lookup |
| `tauri-plugin-log` | Structured logs from Rust and TS |
| `tauri-plugin-updater` | Auto-updates for app and model packs |
| `tauri-plugin-single-instance` | Prevent multiple app windows |
| `tauri-plugin-window-state` | Remember window size/position |
### Tauri v2 Capabilities
Create `src-tauri/capabilities/default.json`:
```json
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Main DM toolkit capability",
"windows": ["main"],
"permissions": [
"core:default",
"store:default",
"fs:default",
"dialog:default",
"shell:allow-open",
"http:default"
]
}
```
For scoped file access:
```json
{
"identifier": "fs:allow-read-text-file",
"allow": [{ "path": "$APPDATA/dm-toolkit/**" }]
}
```
---
## 3. Quick Start — Boilerplate
### Prerequisites
```bash
# Rust & Cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
# Node (for front-end tooling)
brew install node # macOS / Linux; or use nvm
# Tauri v2 CLI
npm install -D @tauri-apps/cli@latest
```
### Scaffold
```bash
npm create tauri-app@latest dm-toolkit -- --template react-ts
cd dm-toolkit
npm install
npm run tauri dev
```
> **Note**: Tauri v2 scaffolds both `src-tauri/src/lib.rs` and `src-tauri/src/main.rs` (mobile/desktop share the lib). Import commands from `@tauri-apps/api/core`, not the old v1 path.
### Add Dependencies
```bash
# LLM binding — pick one:
cargo add llama-cpp-2 # mature, tracks upstream llama.cpp
# cargo add llama_cpp # higher-level, easier to start
# cargo add candle-core # pure-Rust alternative (no C++ build deps)
# Remote API fallback
cargo add reqwest
# Storage
cargo add serde_json
cargo add sqlx # or use tauri-plugin-sql
```
---
## 4. Local LLM Integration
### 4.1 Using `llama-cpp-2` (Recommended)
`llama-cpp-2` is a mature Rust binding that tracks the upstream llama.cpp project. The real API requires: init backend → load GGUF → create context → tokenize prompt → `decode()` batch → sampling loop → decode token-by-token.
```rust
// src-tauri/src/llm.rs
use std::path::PathBuf;
use std::sync::Arc;
use llama_cpp_2::llama_backend::LlamaBackend;
use llama_cpp_2::model::LlamaModel;
use llama_cpp_2::model::params::LlamaModelParams;
use llama_cpp_2::context::params::LlamaContextParams;
pub struct LlmState {
model: Arc<LlamaModel>,
backend: LlamaBackend,
}
impl LlmState {
pub fn new(model_path: &str) -> anyhow::Result<Self> {
let backend = LlamaBackend::init()?;
let model = LlamaModel::load_from_file(
&backend,
model_path,
&LlamaModelParams::default(),
)?;
Ok(Self { model: Arc::new(model), backend })
}
pub fn generate(&self, prompt: &str, max_tokens: usize, temperature: f32) -> anyhow::Result<String> {
let mut ctx = self.model.new_context(&self.backend, LlamaContextParams::default())?;
let tokens = self.model.str_to_token(prompt, llama_cpp_2::model::AddBos::Always)?;
// ... decode batch, sampling loop, collect output tokens ...
// (Full implementation in llama-cpp-2 examples)
todo!("Implement sampling loop")
}
}
```
> **Tip** — Keep model files in `$APPDATA/dm-toolkit/models/`. On first run, ship a small base model and let the user download heavier ones later.
### 4.2 Streaming Tokens via Tauri Channels
`invoke()` returns a single promise, **not** a stream. For streaming LLM tokens, use **Tauri Channels** (`Channel<T>`) or the **event system** (`app.emit()` + frontend `listen()`).
#### Rust — Streaming Command
```rust
use tauri::ipc::Channel;
use serde::Serialize;
#[derive(Clone, Serialize)]
#[serde(tag = "type", content = "payload", rename_all = "camelCase")]
enum LlmEvent {
Token(String),
Error(String),
Done,
}
#[tauri::command]
async fn generate_stream(
state: tauri::State<'_, LlmState>,
prompt: String,
max_tokens: i32,
channel: Channel<LlmEvent>,
) -> Result<(), String> {
tauri::async_runtime::spawn(async move {
// Init backend, load model, create context, tokenize...
// For each decoded token:
// channel.send(LlmEvent::Token(piece)).ok();
// When done:
// channel.send(LlmEvent::Done).ok();
});
Ok(())
}
```
#### Front-End — Consuming the Stream
```tsx
import { invoke, Channel } from "@tauri-apps/api/core";
async function streamGenerate(prompt: string) {
const onToken = new Channel<LlmEvent>();
onToken.onmessage = (event) => {
switch (event.type) {
case "Token": appendText(event.payload); break;
case "Error": console.error(event.payload); break;
case "Done": setStreaming(false); break;
}
};
await invoke("generate_stream", { prompt, maxTokens: 512, channel: onToken });
}
```
### 4.3 Optional Remote API Fallback
```rust
// src-tauri/src/api.rs
use reqwest::Client;
use serde_json::json;
pub async fn query_openai(prompt: &str) -> anyhow::Result<String> {
let client = Client::new();
let res = client.post("https://api.openai.com/v1/chat/completions")
.bearer_auth(std::env::var("OPENAI_API_KEY")?)
.json(&json!({
"model": "gpt-4o-mini",
"messages": [{ "role": "user", "content": prompt }],
"max_tokens": 512
}))
.send()
.await?
.json::<serde_json::Value>()
.await?;
Ok(res["choices"][0]["message"]["content"].as_str().unwrap_or("").to_string())
}
```
> **Important**: GPT-4o-mini is a **remote API model**, not local. Keep local inference via GGUF and use remote APIs only as an optional fallback.
---
## 5. Core Utilities & AI Features
Each module exposes a **Tauri command** (`#[tauri::command]`) that the front-end calls via `invoke`.
| Module | Key AI Tasks | Sample Prompt |
|--------|-------------|---------------|
| **World Builder** | Generate continent names, climate zones, major cities, mythic legends | *"Create a fantasy continent with 3 climates and one legendary creature."* |
| **NPC Generator** | Personality traits, background story, NPC goals, relationship webs | *"Generate a charismatic dwarf blacksmith who despises elves."* |
| **Quest Designer** | Multi-step plot arcs, branching outcomes, hooks | *"Outline a 4-chapter quest where the party seeks the lost crown of Rithor."* |
| **Encounter Builder** | Balanced monster groups, terrain modifiers, loot tables | *"Design an urban ambush for level-5 PCs with 3 bandits and a surprise mob."* |
| **Item Forge** | Stat tables, lore sentences, rarity levels | *"Create a +2 longsword of fire resistance that grants invisibility once per day."* |
| **Initiative Tracker** | Turn order, HP/conditions, round timer | Manage combat state, auto-sort by initiative |
| **Random Tables** | Roll on customizable tables | Treasure, encounters, names, weather |
| **Calendar & Weather** | Fantasy calendar, seasonal events | Custom calendar system with weather |
| **Soundboard** | Local audio clips | Tavern, combat, forest ambience |
| **Map Generator** | Procedural terrain, fog-of-war overlay | Use `react-konva` or `fabric.js` with offline vector tiles |
| **Dice Roller** | 1-to-6 dice + custom pools | *"Roll 4d8+2."* |
| **Session Logger** | Summarize actions, suggest next hooks | *"Summarize last session and propose a hook for the next meeting."* |
| **Puzzle / Trap Designer** | Skill-check flows, trap DCs, hints | Generate puzzle mechanics and trap stat blocks |
| **Name Generator** | Fantasy, sci-fi, historical name banks | Procedural or AI-powered name generation |
| **Homebrew Importer** | Import custom content | Markdown/JSON templates for classes, spells, monsters |
| **Handout Renderer** | Markdown → styled handout → export PNG/PDF | Generate player handouts |
### Example: NPC Generator Command
```rust
// src-tauri/src/commands/npc.rs
use tauri::command;
#[derive(serde::Deserialize)]
pub struct NpcRequest {
pub name: Option<String>,
pub race: String,
pub class: String,
pub alignment: String,
}
#[derive(serde::Serialize)]
pub struct NpcResponse {
pub bio: String,
pub personality: Vec<String>,
pub goals: Vec<String>,
}
#[command]
pub fn generate_npc(req: NpcRequest) -> anyhow::Result<NpcResponse> {
let prompt = format!(
"Create a detailed NPC profile:\n\
Name: {}\nRace: {}\nClass: {}\nAlignment: {}\n\n\
Output in JSON with keys bio, personality (array), goals (array).",
req.name.unwrap_or_else(|| "Unnamed".into()),
req.race, req.class, req.alignment
);
let raw = crate::llm::generate(&prompt, 512)?;
let parsed: NpcResponse = serde_json::from_str(&raw)?;
Ok(parsed)
}
```
---
## 6. Front-End Architecture (React/TS)
### State Management
| Concern | Recommended Tool |
|---------|------------------|
| UI state | **Zustand** or **Jotai** |
| Rust command data | **TanStack Query** (React Query) |
| Type-safe bindings | **`tauri-specta`** — generates TS types from Rust commands |
### Key Libraries
| Need | Library |
|------|---------|
| Map canvas, tokens, fog-of-war | `react-konva` or `fabric.js` |
| Quest / relationship graphs | `react-flow` |
| Markdown editing | `@uiw/react-md-editor` |
| Dice 3D animation | Three.js / `react-three-fiber` (optional) |
| Layout & styling | **`tailwindcss`** + CSS Grid — bento layouts, design tokens |
| Glassmorphism & motion | **`framer-motion`** (hover/press animations), native `backdrop-filter` |
| Icons | **`lucide-react`** — clean, consistent line icons |
| Scrollable panels | **`@radix-ui/react-scroll-area`** — for overflow in bento cards |
---
## 7. Design System — Visual Language
The app should feel like a *magical interface* — a DM's arcane console. The aesthetic is **dark, luminous, and tactile**: deep navy backgrounds with gold accents, glass cards that glow softly, and bento layouts that put every tool within reach without clutter.
### 7.1 Color Palette
| Token | Hex | Usage |
|-------|-----|-------|
| `--bg-deep` | `#0a0e1a` | App background, outer chrome |
| `--bg-surface` | `#111827` | Sidebar, navigation panels |
| `--bg-card` | `#1a2236` | Bento card surfaces |
| `--bg-card-hover` | `#1f2a42` | Hover state on cards |
| `--border-glass` | `rgba(212, 175, 55, 0.12)` | Glass card borders (gold-tinted) |
| `--border-subtle` | `rgba(255, 255, 255, 0.06)` | Dividers, separators |
| `--gold-bright` | `#d4af37` | Primary accent — CTAs, active states, headings |
| `--gold-muted` | `#a8872a` | Secondary accent — secondary buttons, icons |
| `--gold-glow` | `rgba(212, 175, 55, 0.25)` | Glow halos, focus rings, box-shadows |
| `--text-primary` | `#e8e0d0` | Main body text (warm off-white) |
| `--text-secondary` | `#8b9bb4` | Muted text, labels, descriptions |
| `--text-dim` | `#4a5568` | Disabled / placeholder text |
| `--danger` | `#ef4444` | Error, delete, HP-zero |
| `--success` | `#22c55e` | Success, save, HP-full |
| `--info` | `#3b82f6` | Informational highlights |
### 7.2 Glassmorphism
Every bento card uses the same glass treatment:
```css
.glass-card {
background: rgba(26, 34, 54, 0.55); /* --bg-card at 55% opacity */
backdrop-filter: blur(18px) saturate(1.3);
-webkit-backdrop-filter: blur(18px) saturate(1.3);
border: 1px solid rgba(212, 175, 55, 0.12); /* --border-glass */
border-radius: 16px;
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.03),
0 2px 8px rgba(0, 0, 0, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.04);
transition: box-shadow 0.2s, border-color 0.2s;
}
.glass-card:hover {
border-color: rgba(212, 175, 55, 0.25); /* --border-glass brightened */
box-shadow:
0 0 20px rgba(212, 175, 55, 0.08), /* --gold-glow halo */
0 4px 16px rgba(0, 0, 0, 0.5),
inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
```
**Rules of thumb:**
- Glass cards sit on top of a subtle radial gradient or a dim background image (map, parchment texture). The blur lets the background bleed through just enough to feel *alive*.
- On hover, a soft gold glow appears — like candlelight catching the edge of a scroll.
- Active/selected cards get a brighter gold border (`--gold-bright`) and a stronger glow.
- Never use full opacity backgrounds inside bento cards — the glass effect is the identity.
### 7.3 Bento Grid Layout
The main dashboard is a **CSS Grid bento** — asymmetric tiles that pack related tools together. No sidebars-within-sidebars; everything is a card on the grid.
```
┌──────────────┬─────────┬─────────┐
│ │ NPC │ Dice │
│ World Map │ Sheet │ Roller │
│ (2×2) │ (1×1) │ (1×1) │
│ ├─────────┴─────────┤
│ │ │
├──────────────┤ Session Log │
│ Encounter │ (2×1) │
│ Builder │ │
│ (1×1) ├────────┬────────┤
│ │Initi- │ Random │
├──────────────┤ative │ Tables │
│ Quest │ Tracker│ (1×1) │
│ Designer │ (1×1) │ │
│ (2×1) │ │ │
└──────────────┴────────┴────────┘
```
**Implementation** (Tailwind + CSS Grid):
```tsx
// Each bento card is a <BentoCard> wrapper around the real component.
function BentoCard({
children,
className,
span = "col-span-1 row-span-1",
}: Props) {
return (
<div className={`glass-card p-4 ${span} ${className ?? ""}`}>
{children}
</div>
);
}
// Dashboard grid
<div className="grid grid-cols-4 grid-rows-4 gap-3 p-4 h-screen bg-bg-deep">
<BentoCard span="col-span-2 row-span-2"><WorldMap /></BentoCard>
<BentoCard span="col-span-1 row-span-1"><NpcSheet /></BentoCard>
<BentoCard span="col-span-1 row-span-1"><DiceRoller /></BentoCard>
<BentoCard span="col-span-1 row-span-1"><EncounterBuilder /></BentoCard>
<BentoCard span="col-span-2 row-span-1"><SessionLog /></BentoCard>
<BentoCard span="col-span-2 row-span-1"><QuestDesigner /></BentoCard>
<BentoCard span="col-span-1 row-span-1"><InitiativeTracker /></BentoCard>
<BentoCard span="col-span-1 row-span-1"><RandomTables /></BentoCard>
</div>
```
**Bento rules:**
- Cards are **draggable/resizable** — DMs can reorganize their workspace per session.
- Layout preferences persist to `tauri-plugin-store`.
- On narrow windows (laptop), the grid collapses to a 2-column flow.
- Each card header has a subtle gold underline and a `lucide-react` icon.
### 7.4 Typography
| Element | Font | Weight | Size |
|---------|------|--------|------|
| App title / H1 | *Cinzel* (serif display) | 700 | 28px |
| Card headings / H2 | *Cinzel* | 600 | 18px |
| Body text | *Inter* (sans-serif) | 400 | 14px |
| Code / stat blocks | *JetBrains Mono* | 400 | 13px |
| Dice results / numbers | *JetBrains Mono* | 700 | 24px |
Self-host the fonts (offline-first!):
```css
@font-face { font-family: 'Cinzel'; src: url('/fonts/Cinzel-SemiBold.woff2'); font-weight: 600; }
@font-face { font-family: 'Cinzel'; src: url('/fonts/Cinzel-Bold.woff2'); font-weight: 700; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Regular.woff2'); font-weight: 400; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Medium.woff2'); font-weight: 500; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-SemiBold.woff2'); font-weight: 600; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/JetBrainsMono-Regular.woff2'); font-weight: 400; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/JetBrainsMono-Bold.woff2'); font-weight: 700; }
```
### 7.5 Micro-interactions & Motion
| Interaction | Effect |
|-------------|--------|
| Card hover | Gold border brightens; subtle gold `box-shadow` glow fades in (0.2s) |
| Card press / active | Scale down to `0.985`; inner shadow deepens |
| Dice roll | Dice tumbles with `framer-motion` spring; result number scales in with a gold flash |
| AI generation typing | Streamed tokens fade in character-by-character with a gold cursor |
| Tab / panel switch | Crossfade (150ms) — no hard jumps |
| Drag bento card | Card lifts (scale 1.03, shadow deepens); drop zone outlines pulse gold |
| HP bar change | Smooth width transition (300ms); color shifts from `--success``--danger` as HP drops |
| Notification / toast | Slides in from top-right with gold left border; auto-dismisses after 4s |
### 7.6 Component Sketch — BentoCard
```tsx
// BentoCard.tsx — the building block of the entire UI
interface BentoCardProps {
title: string;
icon: React.ReactNode; // lucide-react icon
span?: string; // tailwind grid span classes
children: React.ReactNode;
}
export function BentoCard({ title, icon, span = "col-span-1 row-span-1", children }: BentoCardProps) {
return (
<motion.div
className={`glass-card flex flex-col overflow-hidden ${span}`}
whileHover={{ scale: 1.005 }}
whileTap={{ scale: 0.985 }}
transition={{ type: "spring", stiffness: 400, damping: 25 }}
>
{/* Header */}
<div className="flex items-center gap-2 pb-2 mb-3 border-b border-[var(--border-glass)]">
<span className="text-[var(--gold-bright)]">{icon}</span>
<h2 className="font-cinzel text-sm font-semibold tracking-wide text-[var(--text-primary)]">
{title}
</h2>
</div>
{/* Body */}
<div className="flex-1 overflow-y-auto scrollbar-thin">
{children}
</div>
</motion.div>
);
}
```
### 7.7 App Shell Layout
```
┌────────────────────────────────────────────────────────────┐
│ ⚔ DM-Pal [Campaign ▾] [⚙] [_ □ ✕] │ ← Title bar (Tauri custom)
├────┬───────────────────────────────────────────────────────┤
│ 🗺 │ │
│ 👤 │ Bento Grid Dashboard │
│ ⚔ │ │
│ 🎲 │ ┌──────────┬─────────┬─────────┐ │
│ 📜 │ │ WorldMap │ NPC │ Dice │ │
│ 🎵 │ │ 2×2 │ Sheet │ Roller │ │
│ ⚙ │ │ ├─────────┴─────────┤ │
│ │ │ │ Session Log │ │
│ │ ├──────────┤ 2×1 │ │
│ │ │Encounter ├────────┬─────────┤ │
│ │ │Builder │Init. │ Random │ │
│ │ └──────────┴────────┴─────────┘ │
└────┴───────────────────────────────────────────────────────┘
```
- **Left rail** (56px): icon-only nav, dark surface (`--bg-surface`), gold active indicator.
- **Top bar**: Tauri custom title bar with app name in Cinzel, campaign dropdown, settings gear.
- **Main area**: the bento grid, padded, on `--bg-deep` with a subtle radial gradient center for depth.
- Cards are user-rearrangeable; layout saves to local store.
### 7.8 Dark Mode Is the Only Mode
This app is **dark-only**. The dark blue + gold palette *is* the brand — it evokes candlelit tavern tables and starlit skies. There is no light mode toggle. All design tokens above are tuned for dark backgrounds:
- Text contrast ratios meet WCAG AA on `--bg-card`.
- Gold accents provide vibrancy without neon.
- Glass blur prevents the UI from feeling flat while keeping readability.
- Error/success states use bright red/green that pop against navy.
---
## 8. UI/UX Feature Design
How each feature surfaces in the bento dashboard:
| Feature | Bento Card Design |
|---------|-------------------|
| **World Map** | Large 2×2 card; interactive canvas with zoom, draggable tokens (SVG/Canvas), overlaid lore pins. Background layer is the map image; glass overlay panels for region info on hover. |
| **NPC Sheet** | 1×1 card; gold-bordered portrait area at top; scrollable stats/bio below. AI-generated text streams in with a typing cursor. Tap the ✨ icon to regenerate. |
| **Encounter Board** | 1×1 card; mini monster tokens dragged onto a terrain thumbnail; difficulty badge (color from `--success``--danger`). Tap to expand into a full-screen overlay. |
| **Session Log** | Wide 2×1 card; Markdown editor on the left, AI summary panel on the right (glass panel). Timeline of dice rolls and events with gold timestamps. |
| **Dice Roller Panel** | 1×1 card; big result number in JetBrains Mono 700/24px. Roll history as a subtle scrolling list below. 3D tumble animation on roll. |
| **Initiative Tracker** | 1×1 card; vertical list of combatants, gold border on active turn. HP bars animate from green → red. Condition badges are small glass pills. |
| **Relationship Web** | Full-screen overlay; `react-flow` graph on dark background. Edges colored by sentiment (gold = ally, red = hostile, blue = neutral). |
| **Soundboard** | 1×1 card; grid of small glass buttons with waveform icons. Active ambience glows gold. Volume slider on each tile. |
| **Quest Designer** | 2×1 card; branching flowchart (`react-flow`) with gold connector lines. Nodes are glass cards. AI-suggest button pulses gold when ready. |
| **Calendar & Weather** | 1×1 card; mini calendar grid with gold today-marker. Weather icon per day. Tap to see forecast details in a glass overlay. |
---
## 9. Data Persistence
Two complementary storage layers:
| Layer | What it stores | Implementation |
|-------|----------------|----------------|
| **JSON / Markdown files** | World bible, session logs, character sheets — human-editable, shareable | `tauri-plugin-fs`, `$APPDATA/dm-toolkit/data/` |
| **SQLite** | Indexed search across NPCs, locations, items, tags, relationships | `tauri-plugin-sql` (sqlite feature) or `sqlx` with WAL mode + migrations |
### SQLite Migrations
```rust
use tauri_plugin_sql::{Migration, MigrationKind, Builder};
fn main() {
let migrations = vec![Migration {
version: 1,
description: "create_campaign_tables",
sql: "CREATE TABLE npcs (
id INTEGER PRIMARY KEY,
name TEXT,
race TEXT,
bio TEXT,
tags TEXT
);",
kind: MigrationKind::Up,
}];
tauri::Builder::default()
.plugin(
Builder::default()
.add_migrations("sqlite:campaign.db", migrations)
.build(),
)
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```
### File Persistence Command
```rust
use tauri::path::BaseDirectory;
#[tauri::command]
async fn save_campaign(
app: tauri::AppHandle,
name: String,
data: serde_json::Value,
) -> Result<(), String> {
let path = app
.path()
.resolve(format!("campaigns/{}.json", name), BaseDirectory::AppData)
.map_err(|e| e.to_string())?;
std::fs::create_dir_all(path.parent().unwrap()).map_err(|e| e.to_string())?;
std::fs::write(&path, serde_json::to_string_pretty(&data).unwrap())
.map_err(|e| e.to_string())?;
Ok(())
}
```
> **Tip**: Use WAL mode for concurrent reads, run migrations on startup, and periodic `VACUUM INTO` for backups.
---
## 10. Model Management UX
Local LLMs are not "fire and forget." Plan for:
| Concern | Implementation |
|---------|---------------|
| **First-run wizard** | Detect RAM/VRAM → recommend model size → download GGUF from HuggingFace |
| **Model library UI** | List installed models, quant level, file size, license, hardware fit |
| **Loading state** | Model load can take 530 s on HDD/CPU. Show progress bar and cancel button |
| **GPU offloading** | Expose `n_gpu_layers` slider per model |
| **Context length** | 2k/4k/8k selector with memory warning |
| **Generation controls** | Streaming toggle, temperature, top-p, repeat-penalty per tool |
| **License acceptance** | First-run "model license + download" wizard; don't silently bundle 4 GB models |
---
## 11. Lore Search / RAG
To keep AI-generated content consistent with your world:
1. **Chunk** your world bible into embeddings (local embedding model or llama.cpp embeddings).
2. **Store** vectors in `sqlite-vec` extension or Qdrant-lite for semantic recall.
3. **Inject** relevant lore into LLM prompts before generating content so outputs stay consistent.
---
## 12. Security & Legal Considerations
- **Rule content**: Use **5e SRD / OGL / CC-BY** content only for built-in rule lookups. Full PHB/DMG text is copyrighted.
- **AI output**: AI-generated names, places, and stat blocks can still resemble Wizards IP — add a disclaimer and content moderation toggle.
- **Model licenses**: Model files ship under their own licenses (e.g., Llama 3 requires accepting Meta's license). Build a first-run license acceptance flow.
- **Tauri v2 security**: All file/system access goes through Rust and capability permissions — no arbitrary code execution from the WebView.
---
## 13. Optional Enhancements
| Feature | Implementation Hint |
|---------|----------------------|
| **Plugin System** | Load dynamic libraries (`.so/.dll`) that expose additional commands; register via Tauri's IPC at runtime |
| **Community Share Hub** | Sync campaigns via P2P or Git repo (DMs can clone and pull) |
| **Multiplayer Mode** | Use `tauri::ipc` over WebSocket to synchronize DM/player states in real time |
| **Voice-to-Text** | Integrate Whisper for dictating notes or NPC dialogues |
| **Custom Fine-Tuning** | Store prompt libraries locally; fine-tune the local model on your campaign data |
---
## 14. Resources & Quick Links
- **Tauri v2 Docs** — https://tauri.app/
- **Rust Book** — https://doc.rust-lang.org/book/
- **llama-cpp-2 (Rust bindings)** — https://github.com/utilityai/llama-cpp-rs
- **OpenAI API** — https://platform.openai.com/docs/api-reference/chat/create
- **React Flow** — https://reactflow.dev/
- **SQLite + SQLx** — https://docs.rs/sqlx/latest/sqlx/
- **tauri-specta** — https://github.com/specta-rs/tauri-specta
- **react-konva** — https://github.com/konvajs/react-konva
- **Tailwind CSS** — https://tailwindcss.com/
- **Framer Motion** — https://www.framer.com/motion/
- **Lucide Icons** — https://lucide.dev/
- **Cinzel Font** — https://fonts.google.com/specimen/Cinzel
- **Inter Font** — https://fonts.google.com/specimen/Inter
---
## 15. Development Checkpoints
### Milestone 1 — Skeleton & Hello World
- [ ] Scaffold with `npm create tauri-app@latest` (react-ts template)
- [ ] Configure Tauri v2 capabilities (`src-tauri/capabilities/default.json`)
- [ ] Verify `invoke()` round-trip works with a simple `greet` command
- [ ] Add `tauri-plugin-store`, `tauri-plugin-fs`, `tauri-plugin-log`
- [ ] Commit and tag `v0.1.0-skeleton`
### Milestone 2 — LLM Integration
- [ ] Integrate `llama-cpp-2` (or chosen binding) — load a small GGUF model
- [ ] Implement basic `generate(prompt, max_tokens)` command
- [ ] Implement streaming via Tauri Channels (`Channel<LlmEvent>`)
- [ ] Build first-run model download/license wizard UI
- [ ] Add generation controls (temperature, top-p, context length)
- [ ] Commit and tag `v0.2.0-llm`
### Milestone 3 — Persistence Layer
- [ ] Set up `tauri-plugin-sql` with SQLite + migrations
- [ ] Implement `save_campaign` / `load_campaign` commands
- [ ] Build JSON/Markdown file import/export
- [ ] Commit and tag `v0.3.0-storage`
### Milestone 4 — Core Utilities & Design System (First Pass)
- [ ] NPC Generator command + UI
- [ ] World Builder command + UI
- [ ] Encounter Builder command + UI
- [ ] Session Logger command + UI
- [ ] Dice Roller command + UI
- [ ] Implement design system: `BentoCard`, glassmorphism, dark blue + gold tokens
- [ ] Build bento grid dashboard shell with left rail nav
- [ ] Commit and tag `v0.4.0-utilities`
### Milestone 5 — DM-Specific Tools
- [ ] Initiative / Combat Tracker
- [ ] Random Tables roller
- [ ] Map viewer with fog-of-war (`react-konva`)
- [ ] Calendar & Weather generator
- [ ] Relationship web (`react-flow`)
- [ ] Commit and tag `v0.5.0-dm-tools`
### Milestone 6 — Lore RAG & Polish
- [ ] Add lore chunking + embedding storage (`sqlite-vec`)
- [ ] Inject retrieved lore into LLM prompts
- [ ] Soundboard / ambience module
- [ ] Handout renderer (Markdown → PDF)
- [ ] Polish all glassmorphism effects, micro-interactions, and gold glow states
- [ ] Ensure WCAG AA contrast on all text over glass cards
- [ ] Responsive bento collapse (2-column on narrow windows)
- [ ] Accessibility pass (keyboard nav, screen reader labels, focus rings in `--gold-bright`)
- [ ] Commit and tag `v0.6.0-lore-polish`
### Milestone 7 — Testing, CI, Distribution
- [ ] Unit tests for dice math, encounter balance, storage migrations
- [ ] Cross-platform CI with `tauri-apps/tauri-action`
- [ ] Code signing for macOS and Windows
- [ ] Auto-updater with `tauri-plugin-updater` + delta updates for model packs
- [ ] Package with `npm run tauri build`
- [ ] Commit and tag `v1.0.0-release`
---
## 16. Final Checklist
A consolidated checklist covering all phases:
1. [ ] Scaffold with `npm create tauri-app@latest` (Tauri v2, react-ts)
2. [ ] Configure capabilities (`src-tauri/capabilities/default.json`)
3. [ ] Integrate local LLM binding (`llama-cpp-2`, `llama_cpp`, or Candle)
4. [ ] Stream tokens via Tauri Channels (not raw `invoke`)
5. [ ] Add persistence: `tauri-plugin-store` + `tauri-plugin-fs` + `tauri-plugin-sql`
6. [ ] Implement design system: glassmorphism, bento grid, dark blue + gold palette, Cinzel/Inter/JetBrains Mono fonts
7. [ ] Implement core utilities: World Builder, NPC Generator, Encounter Builder, Item Forge, Session Logger, Dice Roller
8. [ ] Implement DM-specific tools: Initiative Tracker, Random Tables, Fog-of-War, Calendar, Relationship Web, Soundboard
9. [ ] Add lore RAG / semantic search (`sqlite-vec`)
10. [ ] Build first-run model download / license wizard
11. [ ] Add tests, CI (`tauri-action`), code signing, updater, then package with `npm run tauri build`
---
**You're now ready to spin up your own AI-powered Dungeon Master toolkit!**
Happy crafting — may your dice always land favorably! 🎲
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.3 KiB

+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="bluesky-icon" viewBox="0 0 16 17">
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
</symbol>
<symbol id="discord-icon" viewBox="0 0 20 19">
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
</symbol>
<symbol id="documentation-icon" viewBox="0 0 21 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
</symbol>
<symbol id="github-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
</symbol>
<symbol id="social-icon" viewBox="0 0 20 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
</symbol>
<symbol id="x-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

+4
View File
@@ -0,0 +1,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/
/gen/schemas
+4762
View File
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
[package]
name = "dm-pal"
version = "0.1.0"
description = "AI-Powered Dungeon Master Toolkit"
authors = ["DM-Pal Team"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.77.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "app_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.6.3", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
log = "0.4"
tauri = { version = "2.11.3", features = [] }
tauri-plugin-log = "2"
+3
View File
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
+11
View File
@@ -0,0 +1,11 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "DM-Pal default capabilities",
"windows": ["main"],
"permissions": [
"core:default",
"core:window:default",
"core:window:allow-set-title"
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

+22
View File
@@ -0,0 +1,22 @@
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
tauri_plugin_log::Builder::default()
.level(log::LevelFilter::Info)
.build(),
)?;
}
Ok(())
})
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! Welcome to DM-Pal ⚔", name)
}
+6
View File
@@ -0,0 +1,6 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
app_lib::run();
}
+40
View File
@@ -0,0 +1,40 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "DM-Pal",
"version": "0.1.0",
"identifier": "com.dm-pal.app",
"build": {
"frontendDist": "../dist",
"devUrl": "http://localhost:5173",
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build"
},
"app": {
"windows": [
{
"title": "DM-Pal",
"width": 1280,
"height": 800,
"minWidth": 900,
"minHeight": 600,
"resizable": true,
"fullscreen": false,
"decorations": true
}
],
"security": {
"csp": null
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
}
}
+79
View File
@@ -0,0 +1,79 @@
import {
Map,
User,
Swords,
Dice5,
ScrollText,
Volume2,
Settings,
ChevronDown,
} from "lucide-react";
import { Dashboard } from "./components/Dashboard";
const navItems = [
{ icon: Map, label: "World" },
{ icon: User, label: "NPCs" },
{ icon: Swords, label: "Encounter" },
{ icon: Dice5, label: "Dice" },
{ icon: ScrollText, label: "Session" },
{ icon: Volume2, label: "Sound" },
{ icon: Settings, label: "Settings" },
];
export default function App() {
return (
<div className="flex h-screen w-screen overflow-hidden bg-[var(--color-bg-deep)]">
{/* Left Rail */}
<nav className="flex flex-col items-center w-14 bg-[var(--color-bg-surface)] border-r border-[var(--color-border-subtle)] py-3 gap-1 shrink-0">
{/* App Logo */}
<div className="w-8 h-8 rounded-lg bg-[var(--color-gold-bright)] flex items-center justify-center mb-4 text-[var(--color-bg-deep)] font-heading font-bold text-lg">
</div>
{navItems.map((item, i) => (
<button
key={item.label}
className={`w-10 h-10 rounded-lg flex items-center justify-center transition-colors cursor-pointer ${
i === 0
? "bg-[var(--color-bg-card)] text-[var(--color-gold-bright)]"
: "text-[var(--color-text-dim)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-card)]"
}`}
title={item.label}
>
<item.icon size={18} />
</button>
))}
{/* Spacer */}
<div className="flex-1" />
{/* Settings at bottom */}
<button
className="w-10 h-10 rounded-lg flex items-center justify-center text-[var(--color-text-dim)] hover:text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-card)] transition-colors cursor-pointer"
title="Settings"
>
<Settings size={18} />
</button>
</nav>
{/* Main Content Area */}
<div className="flex flex-col flex-1 overflow-hidden">
{/* Title Bar */}
<header className="flex items-center h-10 px-4 bg-[var(--color-bg-surface)] border-b border-[var(--color-border-subtle)] shrink-0" data-tauri-drag-region>
<span className="font-heading text-[var(--color-gold-bright)] text-base font-bold tracking-wider">
DM-Pal
</span>
<div className="ml-4 flex items-center gap-1 text-[var(--color-text-secondary)] text-xs cursor-pointer hover:text-[var(--color-text-primary)] transition-colors">
<ChevronDown size={12} />
<span>My Campaign</span>
</div>
</header>
{/* Dashboard */}
<main className="flex-1 overflow-auto">
<Dashboard />
</main>
</div>
</div>
);
}
+37
View File
@@ -0,0 +1,37 @@
import { motion } from "framer-motion";
import type { ReactNode } from "react";
interface BentoCardProps {
title: string;
icon: ReactNode;
span?: string;
children: ReactNode;
className?: string;
}
export function BentoCard({
title,
icon,
span = "col-span-1 row-span-1",
children,
className = "",
}: BentoCardProps) {
return (
<motion.div
className={`glass-card flex flex-col overflow-hidden p-4 ${span} ${className}`}
whileHover={{ scale: 1.005 }}
whileTap={{ scale: 0.985 }}
transition={{ type: "spring", stiffness: 400, damping: 25 }}
>
{/* Header */}
<div className="flex items-center gap-2 pb-2 mb-3 border-b border-[var(--color-border-glass)]">
<span className="text-[var(--color-gold-bright)]">{icon}</span>
<h2 className="font-heading text-sm font-semibold tracking-wide text-[var(--color-text-primary)]">
{title}
</h2>
</div>
{/* Body */}
<div className="flex-1 overflow-y-auto">{children}</div>
</motion.div>
);
}
+123
View File
@@ -0,0 +1,123 @@
import {
Map,
User,
Swords,
ScrollText,
Dice5,
Timer,
GitBranch,
Volume2,
Calendar,
Sparkles,
} from "lucide-react";
import { BentoCard } from "./BentoCard";
import { Greet } from "./Greet";
export function Dashboard() {
return (
<div className="grid grid-cols-4 grid-rows-4 gap-3 p-4 h-full bg-[var(--color-bg-deep)]">
{/* World Map — 2×2 */}
<BentoCard title="World Map" icon={<Map size={16} />} span="col-span-2 row-span-2">
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Map canvas placeholder
</div>
</BentoCard>
{/* NPC Sheet — 1×1 */}
<BentoCard title="NPC Sheet" icon={<User size={16} />} span="col-span-1 row-span-1">
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
NPC generator placeholder
</div>
</BentoCard>
{/* Dice Roller — 1×1 */}
<BentoCard title="Dice Roller" icon={<Dice5 size={16} />} span="col-span-1 row-span-1">
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Dice roller placeholder
</div>
</BentoCard>
{/* Encounter Builder — 1×1 */}
<BentoCard
title="Encounter"
icon={<Swords size={16} />}
span="col-span-1 row-span-1"
>
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Encounter builder placeholder
</div>
</BentoCard>
{/* Session Log — 2×1 */}
<BentoCard
title="Session Log"
icon={<ScrollText size={16} />}
span="col-span-2 row-span-1"
>
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Session log placeholder
</div>
</BentoCard>
{/* Quest Designer — 2×1 */}
<BentoCard
title="Quest Designer"
icon={<GitBranch size={16} />}
span="col-span-2 row-span-1"
>
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Quest designer placeholder
</div>
</BentoCard>
{/* Initiative Tracker — 1×1 */}
<BentoCard title="Initiative" icon={<Timer size={16} />} span="col-span-1 row-span-1">
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Initiative tracker placeholder
</div>
</BentoCard>
{/* Random Tables — 1×1 */}
<BentoCard
title="Random Tables"
icon={<Sparkles size={16} />}
span="col-span-1 row-span-1"
>
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Random tables placeholder
</div>
</BentoCard>
{/* Greeting / LLM Test — spans bottom area */}
<BentoCard
title="DM-Pal"
icon={<Volume2 size={16} />}
span="col-span-2 row-span-1"
>
<Greet />
</BentoCard>
{/* Calendar — 1×1 */}
<BentoCard
title="Calendar"
icon={<Calendar size={16} />}
span="col-span-1 row-span-1"
>
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Calendar placeholder
</div>
</BentoCard>
{/* Soundboard — 1×1 */}
<BentoCard
title="Soundboard"
icon={<Volume2 size={16} />}
span="col-span-1 row-span-1"
>
<div className="flex items-center justify-center h-full text-[var(--color-text-dim)] text-sm">
Soundboard placeholder
</div>
</BentoCard>
</div>
);
}
+42
View File
@@ -0,0 +1,42 @@
import { useState } from "react";
import { invoke } from "@tauri-apps/api/core";
export function Greet() {
const [greeting, setGreeting] = useState("");
const [name, setName] = useState("");
async function greet() {
// Learn more about Tauri commands at https://v2.tauri.app/develop/calling-rust/
setGreeting(await invoke("greet", { name }));
}
return (
<div className="flex flex-col items-center justify-center h-full gap-3">
<form
className="flex gap-2 w-full max-w-md"
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
className="flex-1 rounded-lg bg-[var(--color-bg-surface)] border border-[var(--color-border-glass)] px-3 py-2 text-[var(--color-text-primary)] placeholder-[var(--color-text-dim)] focus:outline-none focus:border-[var(--color-gold-bright)] text-sm font-[var(--font-sans)]"
onChange={(e) => setName(e.target.value)}
placeholder="Enter a name…"
value={name}
/>
<button
type="submit"
className="rounded-lg bg-[var(--color-gold-bright)] text-[var(--color-bg-deep)] px-4 py-2 text-sm font-semibold hover:bg-[var(--color-gold-muted)] transition-colors cursor-pointer"
>
Greet
</button>
</form>
{greeting && (
<p className="text-[var(--color-text-secondary)] text-sm font-[var(--font-mono)]">
{greeting}
</p>
)}
</div>
);
}
+181
View File
@@ -0,0 +1,181 @@
@import "tailwindcss";
/* ─── Design Tokens ─────────────────────────────────────────── */
@theme {
/* Background layers */
--color-bg-deep: #0a0e1a;
--color-bg-surface: #111827;
--color-bg-card: #1a2236;
--color-bg-card-hover: #1f2a42;
/* Borders */
--color-border-glass: rgba(212, 175, 55, 0.12);
--color-border-subtle: rgba(255, 255, 255, 0.06);
/* Gold accents */
--color-gold-bright: #d4af37;
--color-gold-muted: #a8872a;
--color-gold-glow: rgba(212, 175, 55, 0.25);
/* Text */
--color-text-primary: #e8e0d0;
--color-text-secondary: #8b9bb4;
--color-text-dim: #4a5568;
/* Semantic */
--color-danger: #ef4444;
--color-success: #22c55e;
--color-info: #3b82f6;
/* Fonts */
--font-heading: "Cinzel", serif;
--font-sans: "Inter", system-ui, sans-serif;
--font-mono: "JetBrains Mono", ui-monospace, monospace;
}
/* ─── Self-Hosted Fonts ─────────────────────────────────────── */
/* TODO: download woff2 files to public/fonts/ for offline-first */
/* For now, load from Google Fonts during development */
@font-face {
font-family: "Cinzel";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("https://fonts.gstatic.com/s/cinzel/v25/8vIJ7ww63mViL4j6N6R2lQ.woff2") format("woff2");
}
@font-face {
font-family: "Cinzel";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("https://fonts.gstatic.com/s/cinzel/v25/8vIK7ww63mVnVhR0LQRJNg.woff2") format("woff2");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("https://fonts.gstatic.com/s/inter/v19/UcCO3FwrK3iLTeHuS_nVMrY.woff2") format("woff2");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("https://fonts.gstatic.com/s/inter/v19/UcCO3FwrK3iLTeHuS_nVMrY.woff2") format("woff2");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("https://fonts.gstatic.com/s/inter/v19/UcCO3FwrK3iLTeHuS_nVMrY.woff2") format("woff2");
}
@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("https://fonts.gstatic.com/s/jetbrainsmono/v21/tDbY2o-flEEny0FZhsfKx5Q.woff2") format("woff2");
}
@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("https://fonts.gstatic.com/s/jetbrainsmono/v21/tDbY2o-flEEny0FZhsfKx5Q.woff2") format("woff2");
}
/* ─── Base Styles ───────────────────────────────────────────── */
* {
scrollbar-width: thin;
scrollbar-color: var(--color-gold-muted) transparent;
}
html,
body,
#root {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow: hidden;
background: var(--color-bg-deep);
color: var(--color-text-primary);
font-family: var(--font-sans);
font-size: 14px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* ─── Glassmorphism Card ─────────────────────────────────────── */
.glass-card {
background: rgba(26, 34, 54, 0.55);
backdrop-filter: blur(18px) saturate(1.3);
-webkit-backdrop-filter: blur(18px) saturate(1.3);
border: 1px solid rgba(212, 175, 55, 0.12);
border-radius: 16px;
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.03),
0 2px 8px rgba(0, 0, 0, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.04);
transition:
box-shadow 0.2s ease,
border-color 0.2s ease;
}
.glass-card:hover {
border-color: rgba(212, 175, 55, 0.25);
box-shadow:
0 0 20px rgba(212, 175, 55, 0.08),
0 4px 16px rgba(0, 0, 0, 0.5),
inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.glass-card-active {
border-color: var(--color-gold-bright) !important;
box-shadow:
0 0 24px rgba(212, 175, 55, 0.15),
0 4px 16px rgba(0, 0, 0, 0.5),
inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
/* ─── Utility Classes ────────────────────────────────────────── */
.font-heading {
font-family: var(--font-heading);
}
.font-mono {
font-family: var(--font-mono);
}
.text-gold {
color: var(--color-gold-bright);
}
.border-gold {
border-color: var(--color-gold-bright);
}
.bg-deep {
background-color: var(--color-bg-deep);
}
.bg-surface {
background-color: var(--color-bg-surface);
}
.bg-card {
background-color: var(--color-bg-card);
}
/* Gold glowing focus ring */
*:focus-visible {
outline: 2px solid var(--color-gold-bright);
outline-offset: 2px;
}
+10
View File
@@ -0,0 +1,10 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import App from "./App";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "es2023",
"lib": ["ES2023", "DOM"],
"module": "esnext",
"types": ["vite/client"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
+7
View File
@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "es2023",
"lib": ["ES2023"],
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"module": "nodenext",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}
+23
View File
@@ -0,0 +1,23 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
// https://tauri.app/start/frontend/vite/
export default defineConfig(async () => ({
plugins: [react(), tailwindcss()],
// Vite options tailored for Tauri development
clearScreen: false,
server: {
port: 5173,
strictPort: true,
host: false,
hmr: {
protocol: "ws",
port: 5174,
},
watch: {
ignored: ["**/src-tauri/**"],
},
},
}));