diff --git a/CHANGELOG.md b/CHANGELOG.md index 739cf31..de08646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## 0.13.9 + +Your theme and settings now stay with your library, the title saves on Enter, and a removed row says what happened. + +### New +- **Your look stays put:** the theme, accent and Title field setting are kept with the library's data, not in the browser, and the first frame of the window already shows them. In the desktop app they no longer reset each time it opens. A look chosen in an older version is carried over the first time this one opens. +- **Undo for a restore:** after restoring an item from Trash, "Undo" puts it back in the trash, in place. + +### Improved +- **Merged, restored and deleted rows** leave a clear placeholder in their place, for example "Merged into [the kept title]. The extra copy is in the trash.", until the list is next loaded. +- **Fixed-height title:** the box cuts cleanly at three lines, with a soft fade at the bottom only when the title is longer. +- **System appearance:** checked with the system on dark and on light; the window opens in the right theme both ways. + +### Changed +- **Enter saves the title,** like the other one-line fields. Shift+Enter and Ctrl or Cmd+Enter still save. The "Enter to save" hint shows only while the title has focus. +- **Preferences** lists "Fixed height" first for the Title field. + +### Removed +- The old splash file `splash.html`. The desktop app has used `splash/index.html` since 0.12.0. + +### Known issues +- In the desktop app the splash follows the system's light or dark setting, not a named theme: it is shown before the engine has started. +- A merge cannot be undone from the placeholder. + +### Under the hood +- The desktop shell was compiled on Linux for the first time for this version and built without errors or warnings. Not run: the packaged desktop app on macOS or Windows. + ## 0.13.0 Themes can be picked from one list, the title field has a setting, and removing a row no longer moves the rows below it. diff --git a/NOTICE.md b/NOTICE.md index e8ebb21..0efd815 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -9,7 +9,7 @@ A file brought over from another Form repository gets a row here with its source | Source | License | What came over | | --- | --- | --- | | formtxt v0.38.0 (`nodemode-dev/formtxt`) | Apache-2.0 | `backend/`: the engine entry, `app/main.py`, `app/core/` (config, runtime, startup, local_guard, window_key), the system router, `boot_backend`, `oc_install` and the requirements files, reduced to a skeleton and renamed; the one-time launch code in `window_key.py` is new. `frontend/`: `vite.config.ts`, `tsconfig.json`, `package.json`, `src/io/api.ts`, `src/io/window-key.ts`, `boot_frontend.bat`. The root launcher, installer and `build_app`, and the `setup/` suite, renamed, with the feature commands removed. `src-tauri/`: the whole shell (configuration, capabilities, entitlements, `build.rs` and the eight Rust sources), renamed, with the launch code added | -| formsubstrate v0.25.4 (`nodemode-dev/formsubstrate`) | GPL-3.0-only | `frontend/`: `index.html` (critical style and theme boot), `public/splash.html`, `src/ui/dom.ts`, `src/ui/icons.ts`, `src/ui/themes.ts`, `src/ui/toast.ts`, the shell styles (`tokens`, `shell`, `light-mode`, `scrollbars`), `oc_install` and `boot_frontend`, all reduced. formsubstrate's own notice credits formvis (Apache-2.0, same owner) as the origin of these shell files. Also `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, `SECURITY.md`, `.github/` and `.claude/settings.json`, rewritten for this repository | +| formsubstrate v0.25.4 (`nodemode-dev/formsubstrate`) | GPL-3.0-only | `frontend/`: `index.html` (critical style and theme boot), `public/splash.html` (removed in 0.13.9, replaced by `public/splash/index.html`), `src/ui/dom.ts`, `src/ui/icons.ts`, `src/ui/themes.ts`, `src/ui/toast.ts`, the shell styles (`tokens`, `shell`, `light-mode`, `scrollbars`), `oc_install` and `boot_frontend`, all reduced. formsubstrate's own notice credits formvis (Apache-2.0, same owner) as the origin of these shell files. Also `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, `SECURITY.md`, `.github/` and `.claude/settings.json`, rewritten for this repository | | formDAM v1.32.0 (`nodemode-dev/formDAM`) | Apache-2.0 | Patterns, adapted and not copied: the registry of libraries (`backend/app/libraries.py`) and the copy, move or reference import with SHA-256 (`services/libraryfs.py`) behind `backend/app/store/libraries.py` and `files.py`; the connection set-up and saved searches kept as rules in JSON behind `backend/app/store/db.py` and `searches.py` | | formvfx v0.60.0 (`nodemode-dev/formvfx`) | Apache-2.0 | The way a Rust crate is built into a Python module (`native/fvx-core` and `setup/build_native`), followed in `native/formcite-style` and `setup/build_style`; rewritten, not copied | | formtxt v0.38.0 (`nodemode-dev/formtxt`), since 0.6.0 | Apache-2.0 | `setup/agents.py`: the install half of FormTxt's `setup/agents.py` (the four agent clients, each config file's format, the timestamped backup, the skill copy), rewritten from it with the sync, manifest and dock parts left out. `backend/app/mcp/stdio.py`: the shape of FormTxt's `setup/mcp_stdio.py` (one JSON-RPC message a line, logs on stderr, the parse error), with the library opened in-process instead of forwarding to a running engine | diff --git a/README.md b/README.md index 2b2c7b4..cf20552 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@
-
+
diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md
index 1ec32e1..3320923 100644
--- a/backend/HASHOUT_LOG.md
+++ b/backend/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for this side of the repo. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of this side: read it first, then edit code surgically.
-Current build version: v0.13.0
+Current build version: v0.13.9
Last updated: 2026-11-27 (US Eastern) · the lean rows route for the window's list and opening an attachment
---
@@ -1685,3 +1685,7 @@ Opening a stored PDF attachment now hands it to FormPDF by launching the install
## app/routers/pair.py, app/routers/service.py, app/routers/cite_read.py, app/routers/cite_write.py, app/service/ {#app-cite-service-real-run}
Run in v0.12.0 work (2026-11-27), no code changed. A stand-in Python client asked to pair with scope `write`, a click on Approve in the Connections view in headless Chrome approved it, the client collected the token and ran search, get, cite (apa), bibliography (ieee), add and import against a 2,000-item library: 200, 200, 200, 200, 201, 201. Before approval every call was 403 (`none was sent` without a token, `not known` with a made-up one); after Remove access, 403 `was revoked`. Writes by a revoked token are refused in `auth.check` before `_write`, so they are not in `service-log.jsonl`; that matches the rule that a refusal without a valid holder is not logged. An unknown route under `/api/cite/v1` answers Starlette's 404 `Not Found` to GET and 405 to POST; the 405 is a route outside this slice matching the path for GET only. FormCite answers no JSON-RPC codes; -32001 and -32601 belong to the host that wraps these calls. One data folder was shared across the two runs, so the first click on Remove access in the first run hit the older token row; the revoke result above is from a second run aimed at the live token's row by `data-key`.
+
+## app/core/look_store.py, app/routers/look.py, app/main.py {#app-window-look}
+
+New in v0.13.9 (2026-11-27). The window look (mode, dark theme, light theme, accent, title field) lives in `window-look.json` in the data folder, written the same way as `network.json` in `app/net/switches.py`: a temp file in the same folder, `fsync`, `os.replace`, under a lock. Every value is checked against a fixed list (themes match `frontend/index.html` and `ui/themes.ts`; accent is `#rrggbb` lowercased or empty for the default), and anything else is dropped, so the file can never feed a bad value into the page. `state()` adds `saved`, true once the file exists. `GET` and `PUT /api/window/look` both depend on `window_only`. The router is included from `main.py` because `routers/registry.py` belongs to the orchestrator; moving it into the registry is a one-line change there. `main.py` now answers `GET /` and `GET /index.html` itself, before the static mount, with `Cache-Control: no-store`: when the look is saved it adds `data-fc-...` attributes to the first `` tag, each value passed through `html.escape(quote=True)`. No page script is added and the engine sends no Content-Security-Policy header, so nothing about that changes. Checked across ports 8812 and 8822 on one data folder; the numbers are in the frontend entry `src-look-in-engine`.
diff --git a/backend/app/__init__.py b/backend/app/__init__.py
index f23a6b3..2dd98b1 100644
--- a/backend/app/__init__.py
+++ b/backend/app/__init__.py
@@ -1 +1 @@
-__version__ = "0.13.0"
+__version__ = "0.13.9"
diff --git a/backend/app/core/look_store.py b/backend/app/core/look_store.py
new file mode 100644
index 0000000..3f2bfa0
--- /dev/null
+++ b/backend/app/core/look_store.py
@@ -0,0 +1,85 @@
+import json
+import os
+import re
+import tempfile
+import threading
+from pathlib import Path
+from typing import Any
+
+from app.core.config import data_dir
+
+FILE_NAME = "window-look.json"
+MODES = ("system", "light", "dark")
+DARK = ("default", "studio", "night", "graphite", "midnight", "forest", "ember", "violet", "slate", "mono", "ocean", "rose", "terminal", "amoled", "contrast")
+LIGHT = ("default", "paper", "sand", "sage", "mist", "contrast")
+TITLE_FIELDS = ("fixed", "grow")
+HEX = re.compile(r"^#[0-9a-fA-F]{6}$")
+DEFAULTS: dict[str, str] = {"mode": "system", "dark": "default", "light": "default", "accent": "", "title_field": "fixed"}
+
+_LOCK = threading.Lock()
+
+
+def path() -> Path:
+ return data_dir() / FILE_NAME
+
+
+def _clean(key: str, value: Any) -> str | None:
+ if not isinstance(value, str):
+ return None
+ if key == "mode":
+ return value if value in MODES else None
+ if key == "dark":
+ return value if value in DARK else None
+ if key == "light":
+ return value if value in LIGHT else None
+ if key == "title_field":
+ return value if value in TITLE_FIELDS else None
+ if key == "accent":
+ return value.lower() if value == "" or HEX.match(value) else None
+ return None
+
+
+def _read() -> dict[str, Any] | None:
+ try:
+ data = json.loads(path().read_text(encoding="utf-8"))
+ except (OSError, ValueError):
+ return None
+ return data if isinstance(data, dict) else None
+
+
+def _write(data: dict[str, str]) -> None:
+ target = path()
+ fd, tmp = tempfile.mkstemp(prefix=".window-look.", suffix=".tmp", dir=target.parent)
+ try:
+ with os.fdopen(fd, "w", encoding="utf-8") as handle:
+ json.dump(data, handle, indent=2)
+ handle.flush()
+ os.fsync(handle.fileno())
+ os.replace(tmp, target)
+ except BaseException:
+ Path(tmp).unlink(missing_ok=True)
+ raise
+
+
+def state() -> dict[str, Any]:
+ raw = _read()
+ out: dict[str, Any] = dict(DEFAULTS)
+ if raw is not None:
+ for key in DEFAULTS:
+ value = _clean(key, raw.get(key))
+ if value is not None:
+ out[key] = value
+ out["saved"] = raw is not None
+ return out
+
+
+def update(patch: dict[str, Any]) -> dict[str, Any]:
+ with _LOCK:
+ current = {k: v for k, v in state().items() if k in DEFAULTS}
+ for key in DEFAULTS:
+ if key in patch:
+ value = _clean(key, patch[key])
+ if value is not None:
+ current[key] = value
+ _write(current)
+ return state()
diff --git a/backend/app/main.py b/backend/app/main.py
index 405d4ce..acafbb9 100644
--- a/backend/app/main.py
+++ b/backend/app/main.py
@@ -1,14 +1,19 @@
+import html
import json
import mimetypes
import os
+import re
import time
from contextlib import asynccontextmanager
+from pathlib import Path
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
+from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
-from app.core import config
+from app.core import config, look_store
+from app.routers import look as look_routes
from app.core.local_guard import LocalGuard
from app.core.window_key import WindowKeyGuard
from app.routers import registry
@@ -47,7 +52,30 @@ async def lifespan(_: FastAPI):
app.add_middleware(WindowKeyGuard)
app.add_middleware(LocalGuard, origins=config.cors_origins())
registry.mount(app)
+app.include_router(look_routes.router)
+
+_HTML_TAG = re.compile(r"]*>", re.IGNORECASE)
+_NO_STORE = {"Cache-Control": "no-store", "Pragma": "no-cache"}
+
+
+def _served_index(dist: Path) -> str:
+ page = (dist / "index.html").read_text(encoding="utf-8")
+ look = look_store.state()
+ if not look["saved"]:
+ return page
+ attrs = "".join(f' data-fc-{k.replace("_", "-")}="{html.escape(str(look[k]), quote=True)}"' for k in look_store.DEFAULTS)
+ match = _HTML_TAG.search(page)
+ if match is None:
+ return page
+ tag = match.group(0)
+ return page[: match.start()] + tag[:-1] + attrs + ' data-fc-saved="1">' + page[match.end():]
+
_dist = config.dist_dir()
if _dist is not None:
+ def _index(dist: Path = _dist) -> HTMLResponse:
+ return HTMLResponse(_served_index(dist), headers=_NO_STORE)
+
+ app.add_api_route("/", _index, methods=["GET"], include_in_schema=False)
+ app.add_api_route("/index.html", _index, methods=["GET"], include_in_schema=False)
app.mount("/", StaticFiles(directory=str(_dist), html=True), name="frontend")
diff --git a/backend/app/routers/look.py b/backend/app/routers/look.py
new file mode 100644
index 0000000..b174669
--- /dev/null
+++ b/backend/app/routers/look.py
@@ -0,0 +1,26 @@
+from fastapi import APIRouter, Depends
+from pydantic import BaseModel
+
+from app.core import look_store
+from app.routers.service import window_only
+
+GROUP = "look"
+router = APIRouter(prefix="/api/window", tags=[GROUP], dependencies=[Depends(window_only)])
+
+
+class LookPatch(BaseModel):
+ mode: str | None = None
+ dark: str | None = None
+ light: str | None = None
+ accent: str | None = None
+ title_field: str | None = None
+
+
+@router.get("/look")
+def read_look() -> dict:
+ return look_store.state()
+
+
+@router.put("/look")
+def write_look(body: LookPatch) -> dict:
+ return look_store.update(body.model_dump(exclude_none=True))
diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md
index d790fe9..9c40f58 100644
--- a/frontend/HASHOUT_LOG.md
+++ b/frontend/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for this side of the repo. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of this side: read it first, then edit code surgically.
-Current build version: v0.13.0
+Current build version: v0.13.9
Last updated: 2026-11-26 (US Eastern) · window skeleton: shell, engine store, window key, health status
---
@@ -468,3 +468,11 @@ New in v0.13.0 (2026-11-27). Title keys, as the owner chose: Shift+Enter saves,
## Connections wording, rows that leave without a jump, floating error (v0.13.0)
`ui/connections.ts` `asks` and `may` now read "Asks to search, cite and add to your FormCite library" and "Can search, cite and add to your FormCite library" for scope write, and "Asks to search and cite from your FormCite library" and "Can search and cite from your FormCite library" for read; `Grant` has only those two values. The waiting row shows `may()` alone (the group head already says it waits for the app), so no row wraps at 1400 by 900 or 1100 by 800: every row text is one line of 17 px and every row 109 px. `docs/CITE_SERVICE.md` quotes the new request text. `.fc-conn-error` is absolutely positioned at the bottom of the pane (`.fc-conn` is now `position: relative`) and `:empty` hides it, so the reserved 32 px grid row is gone and the group heads sit directly under the intro. `ui/duplicates.ts` and `ui/trash.ts`: a merge, restore or purge no longer calls `render()` on the click. The node gets `data-gone` ("Merged", "Restored", "Deleted") and `is-gone`; `review.css` hides its children with `visibility` and paints `data-gone` as a muted line in the kept slot, so the height is unchanged and nothing below moves. `paint()` writes only the summary, the empty button and the note; the "Nothing here" note stays off while a placeholder is on screen. The placeholder leaves at the next load (view switch or Look again); `fillGroup` and `fillRow` clear `is-gone`, so a failed request puts the row back in place. Checked in a private built copy, 2,000 items, four DOI pairs, 12 trashed, CPU 4x, 400 ms, 50 kB/s, cache off, fresh engine per load: merge by real click 0.151 before, 0 after; merge by script call 0.1157 before, 0 after; restore by real click 0.0198 before, 0 after; restore by script call 0.0173 before, 0 after.
+
+## index.html, src/io/look.ts, src/ui/themes.ts, src/engine/preferences.ts, public/splash/ {#src-look-in-engine}
+
+New in v0.13.9 (2026-11-27). Browser storage is per origin, and the desktop engine takes a new port on each launch, so `formcite.theme`, `formcite.look` and `formcite.detail` came back empty after every relaunch. The engine now holds the look (see backend `app-window-look`). When it has a saved look, the served `index.html` carries `data-fc-saved="1"` plus `data-fc-mode`, `data-fc-dark`, `data-fc-light`, `data-fc-accent` and `data-fc-title-field` on `html`. The boot script reads those first, browser storage second, and copies the served values into the three storage keys, so every module that reads storage sees the engine's look without a change of its own. Attributes, not an inline JSON script: no value ever reaches script text, and nothing about the page's inline script changes. `io/look.ts` `saveLook` merges patches and sends `PUT /api/window/look` once `hasWindowKey()` is true (it waits up to 10 s and never claims the key itself, since a second claim would race `loadWindowKey`); a failed send keeps the patch for the next one. `setLook`, `saveAppearance` and `setTitleFieldMode` still write storage first, then call `saveLook`. `moveLocalLookToEngine` runs once at module load: with no `data-fc-saved` and any of the three keys present, it sends the whole look, so updating keeps a chosen theme. Under the Vite dev server nothing writes the attributes, so it sends on each load; harmless. The desktop splash (`public/splash/index.html`) is loaded from the app bundle, not from the engine, before the engine has a port: it cannot read the engine's look, and its own storage origin is never written by the window, so it follows the system light or dark setting only. Showing the saved look there would need the shell to read `window-look.json` from the data folder and pass it in. The old `public/splash.html` is removed: nothing loaded it. Checked in a private built copy: data folder on port 8812, Dark, Ocean, accent #20c997, Grow with the title; engine stopped by pid; same folder on port 8822, fresh Playwright context, CPU 4x, 400 ms, 50 kB/s: at DOMContentLoaded `data-theme` dark, `data-dark-theme` ocean, ground rgb(6, 19, 28), `--accent` #20c997; Preferences showed Dark, Ocean checked, #20c997, grow; layout shift 0 without input and 0 with input (0 entries). Migration: empty engine, storage holding dark, forest, sage, #e8590c, grow; after one load `window-look.json` held exactly those. System mode with Ocean and Sand saved: `color_scheme` dark gave dark, ocean, rgb(6, 19, 28) on first load and on reload; light gave light, sand, rgb(239, 232, 218) on both.
+
+## src/ui/detail.ts, src/styles/detail.css, src/ui/pref-detail.ts, src/ui/duplicates.ts, src/ui/trash.ts, src/styles/review.css {#src-title-keys-and-placeholders}
+
+New in v0.13.9 (2026-11-27). Supersedes the title keys in `src-title-field-mode`. Plain Enter now saves the title like every other one-line field; Shift+Enter and Ctrl or Cmd+Enter still save; no line break is ever inserted (Enter during IME composition is swallowed and does not save); Escape restores; blur saves. The hint reads "Enter to save" and is `visibility: hidden` until the title row has `:focus-within`, so its space stays reserved. Fixed mode: the title row draws `::before` and `::after` as grid items over the textarea's cell (`position: relative` lifts them above it without a z-index), each 1 px inside the border and filled with `--surface`, so scrolled text never shows in the top or bottom padding and the box cuts at exactly three lines. `::after` is always `--space-1h` plus `--space-4` tall; only its gradient changes when the row carries `data-overflow="true"`, so the fade never changes geometry. `markOverflow()` reads `scrollHeight` against `clientHeight` once from `fit()` after a value is written, and again from one `ResizeObserver` on the title box (a pane that was hidden or a mode change), and writes only that attribute; it skips a box with no height. In Preferences the select lists "Fixed height" first by sorting a copy of `TITLE_FIELD_OPTIONS` in `pref-detail.ts`; the array itself in `engine/preferences.ts` still lists Grow first. Placeholders: each group and trash row is built once with a hidden `div.fc-rv-gone` (dashed `--line-2` border, `--surface-1` fill, muted 12 px text, centered); a merge or restore or purge writes its sentence and unhides it, and `fillGroup` and `fillRow` hide it again. Merge reads "Merged into [kept title]. The extra copy is (copies are) in the trash." with no Undo, because a merge also fills empty fields and moves attachments and notes onto the kept item, and no engine call reverses that. Restore reads "Restored to the library." with Undo, which calls the existing `POST /library/items/{id}/trash` and puts the same row back in place (no reload, so other placeholders keep their height). Purge reads "Deleted for good." Checked in a private built copy, 2,000 items plus a 300-character and a short title, DOI pairs and trashed items made with `./formcite cli`, CPU 4x, 400 ms, 50 kB/s, cache off, fresh engine per load: six alternating selections in Fixed 0 and 0 (overflow true, false, true, false, true, false); focus and leave the title 0 and 0, hint visible then hidden, no request; Enter one PATCH 200, no line break, leaving after it no second request; merge by click and by script call 0 and 0; restore by click and by script call 0 and 0; Undo 0 and 0; Grow then Fixed again marks overflow true. `fc_exit2.py`: every step 0 and 0, `title_after_in_list` True. Note that the CLI with a copied `FORMCITE_DATA_DIR` still reached the same library as the original folder, so copies of a data folder are not isolated.
diff --git a/frontend/index.html b/frontend/index.html
index 4d72a08..0f82bc2 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -38,6 +38,23 @@
if (typeof s.accentColor === 'string' && /^#[0-9a-fA-F]{6}$/.test(s.accentColor) && s.accentColor.toLowerCase() !== '#a077e0') accent = s.accentColor;
}
} catch (e) { mode = 'system'; }
+ if (d.getAttribute('data-fc-saved') === '1') {
+ var fm = d.getAttribute('data-fc-mode'), fd = d.getAttribute('data-fc-dark'), fl = d.getAttribute('data-fc-light'), fa = d.getAttribute('data-fc-accent') || '', ft = d.getAttribute('data-fc-title-field');
+ if (fm === 'light' || fm === 'dark' || fm === 'system') mode = fm;
+ if (DARK.indexOf(fd) >= 0) look.dark = fd;
+ if (LIGHT.indexOf(fl) >= 0) look.light = fl;
+ accent = /^#[0-9a-fA-F]{6}$/.test(fa) && fa.toLowerCase() !== '#a077e0' ? fa : '';
+ try {
+ var kt = JSON.parse(localStorage.getItem('formcite.theme') || 'null'), kd = JSON.parse(localStorage.getItem('formcite.detail') || 'null');
+ kt = kt && typeof kt === 'object' && !Array.isArray(kt) ? kt : {};
+ kd = kd && typeof kd === 'object' && !Array.isArray(kd) ? kd : {};
+ kt.theme = mode; kt.accentColor = accent;
+ kd.titleField = ft === 'grow' ? 'grow' : 'fixed';
+ localStorage.setItem('formcite.theme', JSON.stringify(kt));
+ localStorage.setItem('formcite.look', JSON.stringify(look));
+ localStorage.setItem('formcite.detail', JSON.stringify(kd));
+ } catch (e) {}
+ }
t = mode === 'system' ? (matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark') : mode;
d.setAttribute('data-theme', t);
d.setAttribute('data-theme-pref', mode);
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index b492ff1..bdff725 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "formcite",
- "version": "0.13.0",
+ "version": "0.13.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "formcite",
- "version": "0.13.0",
+ "version": "0.13.9",
"license": "GPL-3.0-only",
"devDependencies": {
"typescript": "7.0.2",
diff --git a/frontend/package.json b/frontend/package.json
index 1b33453..bc33778 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,7 +1,7 @@
{
"name": "formcite",
"private": true,
- "version": "0.13.0",
+ "version": "0.13.9",
"description": "FormCite: a local-first personal research library from the Form family",
"license": "GPL-3.0-only",
"type": "module",
diff --git a/frontend/public/splash.html b/frontend/public/splash.html
deleted file mode 100644
index 9f81a0e..0000000
--- a/frontend/public/splash.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
Starting FormCite
- diff --git a/frontend/src/engine/preferences.ts b/frontend/src/engine/preferences.ts index cb83ee4..4017bba 100644 --- a/frontend/src/engine/preferences.ts +++ b/frontend/src/engine/preferences.ts @@ -3,6 +3,8 @@ import { createLibrary, readCurrentLibrary, readLibraries, readNetLog, readNetwork, setContact, setNetworkEnabled, setServiceEnabled, useLibrary, type LibraryInfo, type NetLogEntry, type NetOverview, } from '../io/preferences'; +import { engineHasLook, saveLook } from '../io/look'; +import { readLook } from '../ui/themes'; export const LOG_ROWS = 12; @@ -44,6 +46,7 @@ function saveAppearance(a: Appearance): void { } catch (e) { console.error('[appearance] save failed:', e); } + saveLook({ mode: normalizeMode(a.theme), accent: isHex(a.accentColor) ? a.accentColor.toLowerCase() : '' }); } export function applyAppearance(a: Appearance = readAppearance()): void { @@ -108,6 +111,7 @@ export function setTitleFieldMode(mode: TitleField): void { } catch (e) { console.error('[detail prefs] save failed:', e); } + saveLook({ title_field: m }); for (const fn of titleFieldListeners) fn(m); } @@ -142,3 +146,15 @@ export const prefs = { createLibrary, useLibrary, }; + +function moveLocalLookToEngine(): void { + if (engineHasLook()) return; + let found = false; + try { found = [KEY, DETAIL_KEY, 'formcite.look'].some((k) => localStorage.getItem(k) !== null); } catch { found = false; } + if (!found) return; + const a = readAppearance(); + const look = readLook(); + saveLook({ mode: a.theme, accent: a.accentColor.toLowerCase(), dark: look.dark, light: look.light, title_field: titleFieldMode() }); +} + +moveLocalLookToEngine(); diff --git a/frontend/src/io/look.ts b/frontend/src/io/look.ts new file mode 100644 index 0000000..fbd2402 --- /dev/null +++ b/frontend/src/io/look.ts @@ -0,0 +1,47 @@ +import { api } from './api'; +import { hasWindowKey } from './window-key'; + +export interface SavedLook { mode: string; dark: string; light: string; accent: string; title_field: string; saved: boolean } +export type LookPatch = Partial