font updates
This commit is contained in:
BIN
RVM_Beta1.0.zip
Normal file
BIN
RVM_Beta1.0.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
RVM_Beta1.0/RVM_Beta1.0/RVM安装与使用指南Beta1.0.pdf
Normal file
BIN
RVM_Beta1.0/RVM_Beta1.0/RVM安装与使用指南Beta1.0.pdf
Normal file
Binary file not shown.
12
RVM_Beta1.0/RVM_Beta1.0/index.html
Normal file
12
RVM_Beta1.0/RVM_Beta1.0/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>RimWorld Visual Mod Maker v50</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
1242
RVM_Beta1.0/RVM_Beta1.0/package-lock.json
generated
Normal file
1242
RVM_Beta1.0/RVM_Beta1.0/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
RVM_Beta1.0/RVM_Beta1.0/package.json
Normal file
22
RVM_Beta1.0/RVM_Beta1.0/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "rimworld-visual-mod-maker-v50",
|
||||
"version": "0.50.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"web": "vite --host 127.0.0.1",
|
||||
"dev": "vite --host 127.0.0.1",
|
||||
"build": "tsc && vite build"
|
||||
},
|
||||
"dependencies": {
|
||||
"jszip": "3.10.1",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "18.2.66",
|
||||
"@types/react-dom": "18.2.22",
|
||||
"typescript": "5.4.5",
|
||||
"vite": "5.4.21"
|
||||
}
|
||||
}
|
||||
10
RVM_Beta1.0/RVM_Beta1.0/src/main.tsx
Normal file
10
RVM_Beta1.0/RVM_Beta1.0/src/main.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import App from "./ui/App";
|
||||
import "./ui/styles.css";
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
1936
RVM_Beta1.0/RVM_Beta1.0/src/ui/App.tsx
Normal file
1936
RVM_Beta1.0/RVM_Beta1.0/src/ui/App.tsx
Normal file
File diff suppressed because it is too large
Load Diff
78
RVM_Beta1.0/RVM_Beta1.0/src/ui/styles.css
Normal file
78
RVM_Beta1.0/RVM_Beta1.0/src/ui/styles.css
Normal file
@@ -0,0 +1,78 @@
|
||||
:root {
|
||||
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
color: #2e2419;
|
||||
background: #eee8dc;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; }
|
||||
button, input, select, textarea { font: inherit; }
|
||||
button { border: 0; border-radius: 12px; padding: 10px 14px; background: #efe1cf; color: #3d2f20; font-weight: 700; cursor: pointer; }
|
||||
button:hover { filter: brightness(.97); }
|
||||
button.active, button.primary { background: #254834; color: white; }
|
||||
.app { min-height: 100vh; }
|
||||
header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 26px 38px; background: linear-gradient(90deg, #f7f4ed, #eadfcd); border-bottom: 1px solid #d9cab7; position: sticky; top: 0; z-index: 5; }
|
||||
h1 { margin: 0; font-size: 28px; }
|
||||
header p { margin: 8px 0 0; color: #765f48; }
|
||||
code { background: #f3eadb; color: #613b18; border-radius: 8px; padding: 2px 6px; }
|
||||
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
|
||||
.toolbar label { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 14px; background: #fbf8f0; border: 1px solid #e3d2bd; }
|
||||
main { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 96px); align-items: start; }
|
||||
nav {
|
||||
padding: 22px;
|
||||
background: #faf7ef;
|
||||
border-right: 1px solid #decfbd;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
position: sticky;
|
||||
top: 106px;
|
||||
height: calc(100vh - 106px);
|
||||
overflow-y: auto;
|
||||
z-index: 4;
|
||||
}
|
||||
nav::-webkit-scrollbar { width: 8px; }
|
||||
nav::-webkit-scrollbar-thumb { background: #d9cab7; border-radius: 999px; }
|
||||
nav button { text-align: left; }
|
||||
section { padding: 28px; }
|
||||
.grid { display: grid; grid-template-columns: minmax(350px, 1fr) minmax(350px, 1fr); gap: 24px; align-items: start; }
|
||||
.card { background: #fffaf3; border: 1px solid #deceb9; border-radius: 22px; padding: 22px; box-shadow: 0 18px 60px rgba(68,45,20,.08); margin-bottom: 22px; }
|
||||
.card h2 { margin-top: 0; }
|
||||
.field { display: grid; gap: 8px; margin: 14px 0; font-weight: 700; color: #5b452e; }
|
||||
.field input, .field select, .field textarea, select { width: 100%; border: 1px solid #cdb89f; background: white; border-radius: 14px; padding: 12px; color: #22180e; }
|
||||
.field textarea { min-height: 120px; resize: vertical; }
|
||||
.check { display: flex; align-items: center; gap: 10px; margin: 14px 0; padding: 12px; background: #f3eadc; border-radius: 14px; font-weight: 700; }
|
||||
.rowCard { padding: 16px; margin: 16px 0; border: 1px solid #e1d2bf; border-radius: 18px; background: #fffdf8; }
|
||||
.textureGroup { background: #f7efe4; border-radius: 18px; padding: 14px; margin: 16px 0; }
|
||||
.textureGroup h3 { margin: 0 0 10px; }
|
||||
.drop { display: grid; gap: 8px; padding: 16px; border: 2px dashed #c9b69e; border-radius: 18px; background: rgba(255,255,255,.64); margin: 10px 0; min-height: 95px; align-content: center; cursor: pointer; }
|
||||
.drop input { display: none; }
|
||||
.drop.dragOver { background: #e6f4ea; border-color: #2d7a46; }
|
||||
.drop span { color: #735a40; }
|
||||
.asset { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #deceb9; }
|
||||
.errors { color: #aa2a1c; font-weight: 700; }
|
||||
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
|
||||
.chips label { background: #fff; border: 1px solid #e4d5c5; border-radius: 14px; padding: 12px; }
|
||||
pre { white-space: pre-wrap; background: #f4eadb; border-radius: 14px; padding: 18px; }
|
||||
@media (max-width: 900px) { main { grid-template-columns: 1fr; } nav { position: sticky; top: 0; height: auto; max-height: 45vh; overflow-y: auto; border-right: 0; border-bottom: 1px solid #decfbd; } .grid { grid-template-columns: 1fr; } header { align-items: flex-start; flex-direction: column; position: static; } }
|
||||
.rowHeader { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
|
||||
.rowHeader h3 { margin: 0; }
|
||||
button.danger { background: #f4d6d1; color: #8a1f12; }
|
||||
.rowLine { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
|
||||
.selectedGenes { margin: 10px 0 16px; }
|
||||
.chip { display: inline-flex; align-items: center; gap: 6px; background: #dff3e8; border-radius: 999px; padding: 6px 10px; font-weight: 700; }
|
||||
.chip button { padding: 0 6px; border-radius: 999px; background: transparent; }
|
||||
.geneCategory { margin: 16px 0; padding: 14px; border-radius: 18px; background: #f7efe4; }
|
||||
.geneCategory h3 { margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
|
||||
.geneOption { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
|
||||
.geneOption span { display: grid; gap: 4px; }
|
||||
.geneOption em { color: #765f48; font-style: normal; font-size: .92em; }
|
||||
@media (max-width: 700px) { .rowLine { grid-template-columns: 1fr; } .rowHeader { align-items: stretch; flex-direction: column; } }
|
||||
.toolbarInline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
||||
.accordionCard { padding: 0; overflow: hidden; }
|
||||
.accordionHeader { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px; cursor: pointer; background: #f8efe2; border-bottom: 1px solid #e3d3c0; }
|
||||
.accordionHeader:hover { filter: brightness(.985); }
|
||||
.accordionHeader h3 { margin: 0 0 4px; }
|
||||
.accordionHeader p { margin: 0; color: #765f48; font-size: .92rem; }
|
||||
.accordionBody { padding: 16px; }
|
||||
.hint { color: #765f48; font-size: .95rem; }
|
||||
@media (max-width: 700px) { .accordionHeader { align-items: stretch; flex-direction: column; } .toolbarInline { width: 100%; } }
|
||||
1
RVM_Beta1.0/RVM_Beta1.0/src/vite-env.d.ts
vendored
Normal file
1
RVM_Beta1.0/RVM_Beta1.0/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module "*.css";
|
||||
28
RVM_Beta1.0/RVM_Beta1.0/tsconfig.json
Normal file
28
RVM_Beta1.0/RVM_Beta1.0/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"DOM.Iterable",
|
||||
"ES2020"
|
||||
],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"ignoreDeprecations": "5.0"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"references": []
|
||||
}
|
||||
77
RVM_Beta1.0/RVM_Beta1.0/vite.config.js
Normal file
77
RVM_Beta1.0/RVM_Beta1.0/vite.config.js
Normal file
@@ -0,0 +1,77 @@
|
||||
import { defineConfig } from "vite";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
function readRequestBody(req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let body = "";
|
||||
req.setEncoding("utf8");
|
||||
req.on("data", (chunk) => { body += chunk; });
|
||||
req.on("end", () => resolve(body));
|
||||
req.on("error", reject);
|
||||
});
|
||||
}
|
||||
|
||||
function sendJson(res, code, payload) {
|
||||
res.statusCode = code;
|
||||
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||
res.end(JSON.stringify(payload));
|
||||
}
|
||||
|
||||
function sanitizeFileName(value) {
|
||||
return String(value || "modmaker_log.txt")
|
||||
.replace(/[^A-Za-z0-9._-]+/g, "_")
|
||||
.replace(/^_+|_+$/g, "") || "modmaker_log.txt";
|
||||
}
|
||||
|
||||
function modMakerLoggerPlugin() {
|
||||
return {
|
||||
name: "modmaker-terminal-and-file-logger",
|
||||
configureServer(server) {
|
||||
const logsDir = path.resolve(process.cwd(), "logs");
|
||||
const sourceDir = path.resolve(process.cwd(), "source");
|
||||
fs.mkdirSync(logsDir, { recursive: true });
|
||||
fs.mkdirSync(sourceDir, { recursive: true });
|
||||
|
||||
server.middlewares.use(async (req, res, next) => {
|
||||
const url = (req.url || "").split("?")[0];
|
||||
if (req.method !== "POST" || (url !== "/__modmaker/log" && url !== "/__modmaker/export-log" && url !== "/__modmaker/export-source")) return next();
|
||||
try {
|
||||
const raw = await readRequestBody(req);
|
||||
const payload = raw ? JSON.parse(raw) : {};
|
||||
|
||||
if (url === "/__modmaker/log") {
|
||||
const entries = Array.isArray(payload.entries) ? payload.entries : [];
|
||||
for (const entry of entries) {
|
||||
console.log(`[ModMaker][${entry.timestamp || new Date().toISOString()}][${entry.scope || "project"}] ${entry.action || "Log"}: ${entry.detail || ""}`);
|
||||
}
|
||||
return sendJson(res, 200, { ok: true, count: entries.length });
|
||||
}
|
||||
|
||||
if (url === "/__modmaker/export-log") {
|
||||
const fileName = sanitizeFileName(payload.fileName);
|
||||
const target = path.join(logsDir, fileName.endsWith(".txt") ? fileName : `${fileName}.txt`);
|
||||
fs.writeFileSync(target, String(payload.content || ""), "utf8");
|
||||
console.log(`[ModMaker] Full export log written: ${target}`);
|
||||
return sendJson(res, 200, { ok: true, path: target });
|
||||
}
|
||||
|
||||
if (url === "/__modmaker/export-source") {
|
||||
const fileName = sanitizeFileName(payload.fileName);
|
||||
const target = path.join(sourceDir, fileName.endsWith(".json") ? fileName : `${fileName}.json`);
|
||||
fs.writeFileSync(target, String(payload.content || ""), "utf8");
|
||||
console.log(`[ModMaker] Project source written: ${target}`);
|
||||
return sendJson(res, 200, { ok: true, path: target });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[ModMaker] Logger endpoint failed:", error);
|
||||
return sendJson(res, 500, { ok: false, error: String(error) });
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [modMakerLoggerPlugin()]
|
||||
});
|
||||
22
src/App.tsx
22
src/App.tsx
@@ -1,12 +1,14 @@
|
||||
import { useEffect } from 'react';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { useAppStore } from './store/appStore';
|
||||
import { useAppStore, applyTypographyVars, DEFAULT_FONT_FAMILY, DEFAULT_TEXT_COLOR, DEFAULT_FONT_SIZE_INDEX_REAL } from './store/appStore';
|
||||
import AppShell from './components/layout/AppShell';
|
||||
import ConfigScreen from './components/config/ConfigScreen';
|
||||
|
||||
export default function App() {
|
||||
const { isConfigured, setIsConfigured, setUoRoot, setServuoScripts, setCenterMode } =
|
||||
useAppStore();
|
||||
const {
|
||||
isConfigured, setIsConfigured, setUoRoot, setServuoScripts, setCenterMode,
|
||||
setFontFamily, setFontSizeIndex, setTextColor,
|
||||
} = useAppStore();
|
||||
|
||||
useEffect(() => {
|
||||
async function loadConfig() {
|
||||
@@ -14,6 +16,20 @@ export default function App() {
|
||||
const uo = await invoke<string | null>('get_config', { key: 'uo_root' });
|
||||
const scripts = await invoke<string | null>('get_config', { key: 'seruo_scripts' });
|
||||
|
||||
// Load typography settings (non-fatal — fall back to defaults)
|
||||
const fontFamily = await invoke<string | null>('get_config', { key: 'font_family' }).catch(() => null);
|
||||
const fontSizeIdx = await invoke<string | null>('get_config', { key: 'font_size_index' }).catch(() => null);
|
||||
const textColor = await invoke<string | null>('get_config', { key: 'text_color' }).catch(() => null);
|
||||
|
||||
const resolvedFamily = fontFamily ?? DEFAULT_FONT_FAMILY;
|
||||
const resolvedIdx = fontSizeIdx != null ? parseInt(fontSizeIdx, 10) : DEFAULT_FONT_SIZE_INDEX_REAL;
|
||||
const resolvedColor = textColor ?? DEFAULT_TEXT_COLOR;
|
||||
|
||||
setFontFamily(resolvedFamily);
|
||||
setFontSizeIndex(isNaN(resolvedIdx) ? DEFAULT_FONT_SIZE_INDEX_REAL : resolvedIdx);
|
||||
setTextColor(resolvedColor);
|
||||
applyTypographyVars(resolvedFamily, isNaN(resolvedIdx) ? DEFAULT_FONT_SIZE_INDEX_REAL : resolvedIdx, resolvedColor);
|
||||
|
||||
if (uo && scripts) {
|
||||
setUoRoot(uo);
|
||||
setServuoScripts(scripts);
|
||||
|
||||
@@ -129,3 +129,138 @@
|
||||
font-size: 13px;
|
||||
color: #ffd0d0;
|
||||
}
|
||||
|
||||
/* ── Appearance section ─────────────────────────────────────────── */
|
||||
|
||||
.sectionDivider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.sectionDivider::before,
|
||||
.sectionDivider::after {
|
||||
content: '';
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: var(--border);
|
||||
}
|
||||
|
||||
.sectionLabel {
|
||||
font-family: 'Cinzel', serif;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.select {
|
||||
width: 100%;
|
||||
padding: 6px 10px;
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text-primary);
|
||||
font-family: 'EB Garamond', Georgia, serif;
|
||||
font-size: 14px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select:focus {
|
||||
border-color: var(--border-accent);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.fontSizeRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.fontSizeBtn {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
padding: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.fontSizeBtn:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.fontSizeDisplay {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border);
|
||||
padding: 6px 12px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.fontSizePip {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background: var(--border-accent);
|
||||
border: none;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, transform 0.15s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.fontSizePip:hover {
|
||||
background: var(--accent-gold);
|
||||
}
|
||||
|
||||
.fontSizePipActive {
|
||||
background: var(--accent-gold-bright);
|
||||
transform: scale(1.4);
|
||||
}
|
||||
|
||||
.fontSizeLabel {
|
||||
margin-left: auto;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
min-width: 36px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.colorRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.colorPicker {
|
||||
width: 40px;
|
||||
height: 32px;
|
||||
padding: 2px;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--bg-elevated);
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.colorPicker:focus {
|
||||
border-color: var(--border-accent);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.colorHex {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
min-width: 64px;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { useState } from 'react';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import { useAppStore } from '../../store/appStore';
|
||||
import {
|
||||
useAppStore,
|
||||
FONT_SIZE_VALUES,
|
||||
FONT_FAMILY_OPTIONS,
|
||||
} from '../../store/appStore';
|
||||
import styles from './ConfigScreen.module.css';
|
||||
|
||||
interface ValidationResult {
|
||||
@@ -15,7 +19,11 @@ interface Props {
|
||||
}
|
||||
|
||||
export default function ConfigScreen({ onDone }: Props) {
|
||||
const { uoRoot, servuoScripts, setUoRoot, setServuoScripts, setIsConfigured } = useAppStore();
|
||||
const {
|
||||
uoRoot, servuoScripts, setUoRoot, setServuoScripts, setIsConfigured,
|
||||
fontFamily, fontSizeIndex, textColor,
|
||||
setFontFamily, setFontSizeIndex, setTextColor,
|
||||
} = useAppStore();
|
||||
const [uoResults, setUoResults] = useState<ValidationResult[]>([]);
|
||||
const [scriptResults, setScriptResults] = useState<ValidationResult[]>([]);
|
||||
const [saving, setSaving] = useState(false);
|
||||
@@ -43,6 +51,9 @@ export default function ConfigScreen({ onDone }: Props) {
|
||||
try {
|
||||
await invoke('set_config', { key: 'uo_root', value: uoRoot });
|
||||
await invoke('set_config', { key: 'seruo_scripts', value: servuoScripts });
|
||||
await invoke('set_config', { key: 'font_family', value: fontFamily });
|
||||
await invoke('set_config', { key: 'font_size_index', value: String(fontSizeIndex) });
|
||||
await invoke('set_config', { key: 'text_color', value: textColor });
|
||||
setIsConfigured(true);
|
||||
onDone?.();
|
||||
} catch (e) {
|
||||
@@ -52,6 +63,13 @@ export default function ConfigScreen({ onDone }: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleFontSizeDown() {
|
||||
if (fontSizeIndex > 0) setFontSizeIndex(fontSizeIndex - 1);
|
||||
}
|
||||
function handleFontSizeUp() {
|
||||
if (fontSizeIndex < FONT_SIZE_VALUES.length - 1) setFontSizeIndex(fontSizeIndex + 1);
|
||||
}
|
||||
|
||||
const canSave =
|
||||
uoRoot &&
|
||||
servuoScripts &&
|
||||
@@ -94,6 +112,71 @@ export default function ConfigScreen({ onDone }: Props) {
|
||||
{scriptResults.length > 0 && <ValidationList results={scriptResults} />}
|
||||
</div>
|
||||
|
||||
{/* ── Appearance ────────────────────────────────────────────── */}
|
||||
<div className={styles.sectionDivider}>
|
||||
<span className={styles.sectionLabel}>Appearance</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.field}>
|
||||
<label className={styles.label}>Font Family</label>
|
||||
<select
|
||||
className={styles.select}
|
||||
value={fontFamily}
|
||||
onChange={(e) => setFontFamily(e.target.value)}
|
||||
>
|
||||
{FONT_FAMILY_OPTIONS.map((opt) => (
|
||||
<option key={opt.value} value={opt.value}>{opt.label}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className={styles.field}>
|
||||
<label className={styles.label}>Font Size</label>
|
||||
<div className={styles.fontSizeRow}>
|
||||
<button
|
||||
className={`${styles.btn} ${styles.fontSizeBtn}`}
|
||||
onClick={handleFontSizeDown}
|
||||
disabled={fontSizeIndex === 0}
|
||||
title="Decrease font size"
|
||||
>−</button>
|
||||
<div className={styles.fontSizeDisplay}>
|
||||
{FONT_SIZE_VALUES.map((sz, i) => (
|
||||
<button
|
||||
key={sz}
|
||||
className={`${styles.fontSizePip} ${i === fontSizeIndex ? styles.fontSizePipActive : ''}`}
|
||||
onClick={() => setFontSizeIndex(i)}
|
||||
title={`${sz}px`}
|
||||
/>
|
||||
))}
|
||||
<span className={styles.fontSizeLabel}>{FONT_SIZE_VALUES[fontSizeIndex]}px</span>
|
||||
</div>
|
||||
<button
|
||||
className={`${styles.btn} ${styles.fontSizeBtn}`}
|
||||
onClick={handleFontSizeUp}
|
||||
disabled={fontSizeIndex === FONT_SIZE_VALUES.length - 1}
|
||||
title="Increase font size"
|
||||
>+</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.field}>
|
||||
<label className={styles.label}>Text Color</label>
|
||||
<div className={styles.colorRow}>
|
||||
<input
|
||||
type="color"
|
||||
className={styles.colorPicker}
|
||||
value={textColor}
|
||||
onChange={(e) => setTextColor(e.target.value)}
|
||||
/>
|
||||
<span className={styles.colorHex}>{textColor}</span>
|
||||
<button
|
||||
className={`${styles.btn} ${styles.btnSecondary}`}
|
||||
onClick={() => setTextColor('#d4c49a')}
|
||||
title="Reset to default parchment color"
|
||||
>Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error && <div className={styles.error}>{error}</div>}
|
||||
|
||||
<div className={styles.actions}>
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
--accent-green: #3a6b3a;
|
||||
--scrollbar-thumb: #3a3020;
|
||||
|
||||
font-family: 'EB Garamond', Georgia, serif;
|
||||
font-size: 16px;
|
||||
--font-family-body: 'EB Garamond', Georgia, serif;
|
||||
--font-size-base: 16px;
|
||||
|
||||
font-family: var(--font-family-body);
|
||||
font-size: var(--font-size-base);
|
||||
color: var(--text-primary);
|
||||
background-color: var(--bg-base);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,35 @@ import type { TileInfo } from '../types/assets';
|
||||
import type { ClassSummary, MethodSummary, FlowNode } from '../types/scripts';
|
||||
import type { GumpDrawList } from '../types/gump';
|
||||
|
||||
// ── Typography constants ──────────────────────────────────────────────────────
|
||||
|
||||
// 7 sizes; index 1 = 16px (the current/default size per spec)
|
||||
export const FONT_SIZE_VALUES = [13, 16, 18, 20, 22, 24, 28] as const;
|
||||
|
||||
export interface FontFamilyOption {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export const FONT_FAMILY_OPTIONS: FontFamilyOption[] = [
|
||||
{ label: 'EB Garamond (Default)', value: "'EB Garamond', Georgia, serif" },
|
||||
{ label: 'Cinzel', value: "'Cinzel', serif" },
|
||||
{ label: 'Georgia', value: 'Georgia, serif' },
|
||||
{ label: 'Palatino', value: "'Palatino Linotype', Palatino, serif" },
|
||||
{ label: 'System UI', value: 'system-ui, sans-serif' },
|
||||
];
|
||||
|
||||
export const DEFAULT_FONT_FAMILY = FONT_FAMILY_OPTIONS[0].value;
|
||||
export const DEFAULT_TEXT_COLOR = '#d4c49a';
|
||||
export const DEFAULT_FONT_SIZE_INDEX_REAL = 1; // index 1 = 16px
|
||||
|
||||
export function applyTypographyVars(fontFamily: string, fontSizeIndex: number, textColor: string) {
|
||||
const size = FONT_SIZE_VALUES[fontSizeIndex] ?? 16;
|
||||
document.documentElement.style.setProperty('--font-family-body', fontFamily);
|
||||
document.documentElement.style.setProperty('--font-size-base', `${size}px`);
|
||||
document.documentElement.style.setProperty('--text-primary', textColor);
|
||||
}
|
||||
|
||||
export type LeftPanelTab = 'scripts' | 'statics' | 'mobiles' | 'gumps';
|
||||
|
||||
export type CenterMode =
|
||||
@@ -38,6 +67,14 @@ interface AppState {
|
||||
setAssetFormat: (f: 'mul' | 'uop') => void;
|
||||
setIsConfigured: (v: boolean) => void;
|
||||
|
||||
// Typography
|
||||
fontFamily: string;
|
||||
fontSizeIndex: number;
|
||||
textColor: string;
|
||||
setFontFamily: (f: string) => void;
|
||||
setFontSizeIndex: (i: number) => void;
|
||||
setTextColor: (c: string) => void;
|
||||
|
||||
// Navigation
|
||||
activeTab: LeftPanelTab;
|
||||
centerMode: CenterMode;
|
||||
@@ -88,6 +125,28 @@ export const useAppStore = create<AppState>((set) => ({
|
||||
setAssetFormat: (f) => set({ assetFormat: f }),
|
||||
setIsConfigured: (v) => set({ isConfigured: v }),
|
||||
|
||||
fontFamily: DEFAULT_FONT_FAMILY,
|
||||
fontSizeIndex: DEFAULT_FONT_SIZE_INDEX_REAL,
|
||||
textColor: DEFAULT_TEXT_COLOR,
|
||||
setFontFamily: (f) => {
|
||||
set((s) => {
|
||||
applyTypographyVars(f, s.fontSizeIndex, s.textColor);
|
||||
return { fontFamily: f };
|
||||
});
|
||||
},
|
||||
setFontSizeIndex: (i) => {
|
||||
set((s) => {
|
||||
applyTypographyVars(s.fontFamily, i, s.textColor);
|
||||
return { fontSizeIndex: i };
|
||||
});
|
||||
},
|
||||
setTextColor: (c) => {
|
||||
set((s) => {
|
||||
applyTypographyVars(s.fontFamily, s.fontSizeIndex, c);
|
||||
return { textColor: c };
|
||||
});
|
||||
},
|
||||
|
||||
activeTab: 'statics',
|
||||
centerMode: 'empty',
|
||||
setActiveTab: (tab) => set({ activeTab: tab }),
|
||||
|
||||
Reference in New Issue
Block a user