From 39fca1ef7b9431c12e455771131c1f14c013085c Mon Sep 17 00:00:00 2001 From: MotherSphere Date: Mon, 12 Oct 2026 18:27:47 +0200 Subject: [PATCH] feat: use the shared Colony accent colours and current themes, and adopt the Colony repository layout Move the Tauri scaffold to the organisation layout: the crate manifests, build.rs and tauri.conf.json at the root, the Rust code in src/, the interface in src/ui/, the icons in assets/icons/ and the capabilities in config/capabilities/. tauri-build regenerates permissions/ and gen/schemas/ on every build, so they are ignored instead of committed. release-please switches to release-type rust, which bumps Cargo.toml and Cargo.lock itself, and the Tauri identifier becomes io.github.project-colony.memorystick. Vendor the Colony themes, themes.json and colony-accents.css from Project-Colony-Resources 7247b81, whose generated/ matches colony-ui 0.1.6. The accent override and the Preferences swatches now both read their colour from colony-accents.css, loaded before the themes so each theme keeps its own accent until the user picks one. CI compares all three files with upstream, and the themes check also requires every listed accent to exist there. --- .github/dependabot.yml | 7 ++- .github/scripts/check-colony-themes.py | 46 ++++++++++++------ .github/scripts/check-document-filter.py | 8 +-- .github/workflows/ci.yml | 26 ++++------ .github/workflows/release.yml | 8 +-- .gitignore | 6 ++- src-tauri/Cargo.lock => Cargo.lock | 0 src-tauri/Cargo.toml => Cargo.toml | 0 README.md | 15 +++--- SECURITY.md | 2 +- {src-tauri => assets}/icons/128x128.png | Bin {src-tauri => assets}/icons/128x128@2x.png | Bin {src-tauri => assets}/icons/32x32.png | Bin {src-tauri => assets}/icons/icon.icns | Bin {src-tauri => assets}/icons/icon.ico | Bin {src-tauri => assets}/icons/icon.png | Bin src-tauri/build.rs => build.rs | 24 +++++---- colony.json | 2 +- .../capabilities/default.json | 2 +- dist/vendor/colony/README.md | 33 ------------- docs/third-party-notices.md | 26 +++++----- release-please-config.json | 10 +--- .../permissions/autogenerated/load_file.toml | 11 ----- .../autogenerated/open_document.toml | 11 ----- .../autogenerated/save_preferences.toml | 11 ----- .../autogenerated/third_party_licenses.toml | 11 ----- {src-tauri/src => src}/document.rs | 2 +- {src-tauri/src => src}/licenses.rs | 0 {src-tauri/src => src}/main.rs | 0 {src-tauri/src => src}/markdown.rs | 0 {src-tauri/src => src}/navigation.rs | 0 {src-tauri/src => src}/preferences.rs | 4 +- {dist => src/ui}/app.js | 2 +- .../ui}/fonts/JetBrainsMonoNerdFont-Bold.ttf | Bin .../fonts/JetBrainsMonoNerdFont-Medium.ttf | Bin .../fonts/JetBrainsMonoNerdFont-Regular.ttf | Bin {dist => src/ui}/fonts/LICENSE | 0 .../ui}/fonts/OpenDyslexic-Regular.otf | Bin {dist => src/ui}/fonts/fa-solid-900.ttf | Bin {dist => src/ui}/i18n.js | 0 {dist => src/ui}/i18n/en.json | 0 {dist => src/ui}/i18n/fr.json | 0 {dist => src/ui}/index.html | 5 +- {dist => src/ui}/preferences.js | 3 +- {dist => src/ui}/styles.css | 0 {dist => src/ui}/theme.js | 15 +++++- src/ui/vendor/colony/README.md | 44 +++++++++++++++++ src/ui/vendor/colony/colony-accents.css | 17 +++++++ .../ui}/vendor/colony/colony-themes.css | 0 {dist => src/ui}/vendor/colony/themes.json | 4 +- {dist => src/ui}/vendor/highlight/LICENSE | 0 .../ui}/vendor/highlight/highlight.min.js | 0 {dist => src/ui}/vendor/katex/LICENSE | 0 .../vendor/katex/fonts/KaTeX_AMS-Regular.ttf | Bin .../vendor/katex/fonts/KaTeX_AMS-Regular.woff | Bin .../katex/fonts/KaTeX_AMS-Regular.woff2 | Bin .../katex/fonts/KaTeX_Caligraphic-Bold.ttf | Bin .../katex/fonts/KaTeX_Caligraphic-Bold.woff | Bin .../katex/fonts/KaTeX_Caligraphic-Bold.woff2 | Bin .../katex/fonts/KaTeX_Caligraphic-Regular.ttf | Bin .../fonts/KaTeX_Caligraphic-Regular.woff | Bin .../fonts/KaTeX_Caligraphic-Regular.woff2 | Bin .../vendor/katex/fonts/KaTeX_Fraktur-Bold.ttf | Bin .../katex/fonts/KaTeX_Fraktur-Bold.woff | Bin .../katex/fonts/KaTeX_Fraktur-Bold.woff2 | Bin .../katex/fonts/KaTeX_Fraktur-Regular.ttf | Bin .../katex/fonts/KaTeX_Fraktur-Regular.woff | Bin .../katex/fonts/KaTeX_Fraktur-Regular.woff2 | Bin .../vendor/katex/fonts/KaTeX_Main-Bold.ttf | Bin .../vendor/katex/fonts/KaTeX_Main-Bold.woff | Bin .../vendor/katex/fonts/KaTeX_Main-Bold.woff2 | Bin .../katex/fonts/KaTeX_Main-BoldItalic.ttf | Bin .../katex/fonts/KaTeX_Main-BoldItalic.woff | Bin .../katex/fonts/KaTeX_Main-BoldItalic.woff2 | Bin .../vendor/katex/fonts/KaTeX_Main-Italic.ttf | Bin .../vendor/katex/fonts/KaTeX_Main-Italic.woff | Bin .../katex/fonts/KaTeX_Main-Italic.woff2 | Bin .../vendor/katex/fonts/KaTeX_Main-Regular.ttf | Bin .../katex/fonts/KaTeX_Main-Regular.woff | Bin .../katex/fonts/KaTeX_Main-Regular.woff2 | Bin .../katex/fonts/KaTeX_Math-BoldItalic.ttf | Bin .../katex/fonts/KaTeX_Math-BoldItalic.woff | Bin .../katex/fonts/KaTeX_Math-BoldItalic.woff2 | Bin .../vendor/katex/fonts/KaTeX_Math-Italic.ttf | Bin .../vendor/katex/fonts/KaTeX_Math-Italic.woff | Bin .../katex/fonts/KaTeX_Math-Italic.woff2 | Bin .../katex/fonts/KaTeX_SansSerif-Bold.ttf | Bin .../katex/fonts/KaTeX_SansSerif-Bold.woff | Bin .../katex/fonts/KaTeX_SansSerif-Bold.woff2 | Bin .../katex/fonts/KaTeX_SansSerif-Italic.ttf | Bin .../katex/fonts/KaTeX_SansSerif-Italic.woff | Bin .../katex/fonts/KaTeX_SansSerif-Italic.woff2 | Bin .../katex/fonts/KaTeX_SansSerif-Regular.ttf | Bin .../katex/fonts/KaTeX_SansSerif-Regular.woff | Bin .../katex/fonts/KaTeX_SansSerif-Regular.woff2 | Bin .../katex/fonts/KaTeX_Script-Regular.ttf | Bin .../katex/fonts/KaTeX_Script-Regular.woff | Bin .../katex/fonts/KaTeX_Script-Regular.woff2 | Bin .../katex/fonts/KaTeX_Size1-Regular.ttf | Bin .../katex/fonts/KaTeX_Size1-Regular.woff | Bin .../katex/fonts/KaTeX_Size1-Regular.woff2 | Bin .../katex/fonts/KaTeX_Size2-Regular.ttf | Bin .../katex/fonts/KaTeX_Size2-Regular.woff | Bin .../katex/fonts/KaTeX_Size2-Regular.woff2 | Bin .../katex/fonts/KaTeX_Size3-Regular.ttf | Bin .../katex/fonts/KaTeX_Size3-Regular.woff | Bin .../katex/fonts/KaTeX_Size3-Regular.woff2 | Bin .../katex/fonts/KaTeX_Size4-Regular.ttf | Bin .../katex/fonts/KaTeX_Size4-Regular.woff | Bin .../katex/fonts/KaTeX_Size4-Regular.woff2 | Bin .../katex/fonts/KaTeX_Typewriter-Regular.ttf | Bin .../katex/fonts/KaTeX_Typewriter-Regular.woff | Bin .../fonts/KaTeX_Typewriter-Regular.woff2 | Bin {dist => src/ui}/vendor/katex/katex.min.css | 0 {dist => src/ui}/vendor/katex/katex.min.js | 0 {dist => src/ui}/vendor/mermaid/LICENSE | 0 .../ui}/vendor/mermaid/mermaid.min.js | 0 src-tauri/tauri.conf.json => tauri.conf.json | 14 +++--- 118 files changed, 188 insertions(+), 181 deletions(-) rename src-tauri/Cargo.lock => Cargo.lock (100%) rename src-tauri/Cargo.toml => Cargo.toml (100%) rename {src-tauri => assets}/icons/128x128.png (100%) rename {src-tauri => assets}/icons/128x128@2x.png (100%) rename {src-tauri => assets}/icons/32x32.png (100%) rename {src-tauri => assets}/icons/icon.icns (100%) rename {src-tauri => assets}/icons/icon.ico (100%) rename {src-tauri => assets}/icons/icon.png (100%) rename src-tauri/build.rs => build.rs (91%) rename {src-tauri => config}/capabilities/default.json (89%) delete mode 100644 dist/vendor/colony/README.md delete mode 100644 src-tauri/permissions/autogenerated/load_file.toml delete mode 100644 src-tauri/permissions/autogenerated/open_document.toml delete mode 100644 src-tauri/permissions/autogenerated/save_preferences.toml delete mode 100644 src-tauri/permissions/autogenerated/third_party_licenses.toml rename {src-tauri/src => src}/document.rs (99%) rename {src-tauri/src => src}/licenses.rs (100%) rename {src-tauri/src => src}/main.rs (100%) rename {src-tauri/src => src}/markdown.rs (100%) rename {src-tauri/src => src}/navigation.rs (100%) rename {src-tauri/src => src}/preferences.rs (97%) rename {dist => src/ui}/app.js (99%) rename {dist => src/ui}/fonts/JetBrainsMonoNerdFont-Bold.ttf (100%) rename {dist => src/ui}/fonts/JetBrainsMonoNerdFont-Medium.ttf (100%) rename {dist => src/ui}/fonts/JetBrainsMonoNerdFont-Regular.ttf (100%) rename {dist => src/ui}/fonts/LICENSE (100%) rename {dist => src/ui}/fonts/OpenDyslexic-Regular.otf (100%) rename {dist => src/ui}/fonts/fa-solid-900.ttf (100%) rename {dist => src/ui}/i18n.js (100%) rename {dist => src/ui}/i18n/en.json (100%) rename {dist => src/ui}/i18n/fr.json (100%) rename {dist => src/ui}/index.html (90%) rename {dist => src/ui}/preferences.js (99%) rename {dist => src/ui}/styles.css (100%) rename {dist => src/ui}/theme.js (90%) create mode 100644 src/ui/vendor/colony/README.md create mode 100644 src/ui/vendor/colony/colony-accents.css rename {dist => src/ui}/vendor/colony/colony-themes.css (100%) rename {dist => src/ui}/vendor/colony/themes.json (99%) rename {dist => src/ui}/vendor/highlight/LICENSE (100%) rename {dist => src/ui}/vendor/highlight/highlight.min.js (100%) rename {dist => src/ui}/vendor/katex/LICENSE (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_AMS-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_AMS-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Caligraphic-Bold.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Caligraphic-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Fraktur-Bold.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Fraktur-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Bold.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Bold.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Bold.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-BoldItalic.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Italic.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Italic.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Italic.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Main-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Math-BoldItalic.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Math-Italic.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Math-Italic.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Math-Italic.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Bold.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Italic.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Script-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Script-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Script-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size1-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size1-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size2-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size2-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size3-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size3-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size4-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size4-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Typewriter-Regular.ttf (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff (100%) rename {dist => src/ui}/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 (100%) rename {dist => src/ui}/vendor/katex/katex.min.css (100%) rename {dist => src/ui}/vendor/katex/katex.min.js (100%) rename {dist => src/ui}/vendor/mermaid/LICENSE (100%) rename {dist => src/ui}/vendor/mermaid/mermaid.min.js (100%) rename src-tauri/tauri.conf.json => tauri.conf.json (85%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b276d15..75ddf2b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,11 @@ # Keep the supply chain current: GitHub Actions and Cargo dependencies. # -# Copied from Project-Colony-Resources templates/dependabot.yml. The one -# difference is the cargo directory: the crate lives in src-tauri/. +# Copied from Project-Colony-Resources templates/dependabot.yml. # # Dependabot opening a PR is not the rule being followed; merging it is. See # design/dependencies.md: everything is on its latest release, always. # -# The libraries in dist/vendor/ (highlight.js, KaTeX, Mermaid, the Colony +# The libraries in src/ui/vendor/ (highlight.js, KaTeX, Mermaid, the Colony # themes) are not packages Dependabot can see. Check them by hand on the # weekly pass; docs/third-party-notices.md lists their versions. version: 2 @@ -29,7 +28,7 @@ updates: patterns: ["*"] - package-ecosystem: cargo - directory: /src-tauri + directory: / schedule: interval: weekly open-pull-requests-limit: 5 diff --git a/.github/scripts/check-colony-themes.py b/.github/scripts/check-colony-themes.py index 4bd5a77..ad95511 100644 --- a/.github/scripts/check-colony-themes.py +++ b/.github/scripts/check-colony-themes.py @@ -1,10 +1,13 @@ #!/usr/bin/env python3 -"""Check that dist/ only uses Colony colours that every theme defines. +"""Check that src/ui/ only uses Colony colours that every theme defines. -dist/vendor/colony/colony-themes.css sets the --colony-* variables once per +src/ui/vendor/colony/colony-themes.css sets the --colony-* variables once per theme, and themes.json lists the themes the picker offers. A variable one theme lacks leaves that colour unset in that theme, so this fails on it, and on a picker entry with no CSS block or a CSS block with no picker entry. +colony-accents.css sets the accent colours once for every theme, so a +variable it defines counts as defined everywhere, and every accent the +picker offers must be one of them. """ import json @@ -12,29 +15,40 @@ import sys from pathlib import Path -dist = Path(__file__).resolve().parents[2] / "dist" -vendor = dist / "vendor" / "colony" +ui = Path(__file__).resolve().parents[2] / "src" / "ui" +vendor = ui / "vendor" / "colony" + + +def variables(css_file): + """{selector: set of --colony-* names}, comments out first: the file + header quotes a selector.""" + css = re.sub(r"/\*.*?\*/", "", (vendor / css_file).read_text(encoding="utf-8"), flags=re.S) + return { + selector.strip(): set(re.findall(r"(--colony-[a-z0-9-]+):", body)) + for selector, body in re.findall(r"([^{}]+)\{([^}]*)\}", css) + } + -# Comments out first: the file header quotes a selector. -css = re.sub(r"/\*.*?\*/", "", (vendor / "colony-themes.css").read_text(encoding="utf-8"), flags=re.S) themes = { - slug: set(re.findall(r"(--colony-[a-z0-9-]+):", body)) - for slug, body in re.findall(r'\[data-colony-theme="([^"]+)"\][^{]*\{([^}]*)\}', css) -} -listed = { - variant["slug"] - for family in json.loads((vendor / "themes.json").read_text(encoding="utf-8"))["families"] - for variant in family["variants"] + re.search(r'\[data-colony-theme="([^"]+)"\]', selector).group(1): defined + for selector, defined in variables("colony-themes.css").items() + if "[data-colony-theme=" in selector } +accents = variables("colony-accents.css").get(":root", set()) +theme_list = json.loads((vendor / "themes.json").read_text(encoding="utf-8")) +listed = {variant["slug"] for family in theme_list["families"] for variant in family["variants"]} errors = [] if not themes or set(themes) != listed: errors.append(f"themes.json and colony-themes.css disagree: {sorted(set(themes) ^ listed)}") -for path in sorted(dist.glob("*.*")): - for var in sorted(set(re.findall(r"--colony-[a-z0-9-]+", path.read_text(encoding="utf-8")))): +for accent in theme_list["accents"]: + if accent["cssVar"] not in accents: + errors.append(f"themes.json: accent {accent['key']} has no {accent['cssVar']} in colony-accents.css") +for path in sorted(ui.glob("*.*")): + for var in sorted(set(re.findall(r"--colony-[a-z0-9-]+", path.read_text(encoding="utf-8"))) - accents): missing = [slug for slug, defined in themes.items() if var not in defined] if missing: errors.append(f"{path.name}: {var} is missing from {', '.join(missing)}") -print("\n".join(errors) or f"OK: all {len(themes)} themes define every --colony-* variable in dist/") +print("\n".join(errors) or f"OK: all {len(themes)} themes define every --colony-* variable in src/ui/") sys.exit(1 if errors else 0) diff --git a/.github/scripts/check-document-filter.py b/.github/scripts/check-document-filter.py index f61b171..3cbba36 100644 --- a/.github/scripts/check-document-filter.py +++ b/.github/scripts/check-document-filter.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Check that render() in dist/app.js still drops every element that could act +"""Check that render() in src/ui/app.js still drops every element that could act on MemoryStick's own page. comrak keeps a document's raw HTML as written, and the inert