Re-base the UI layer onto the neiam-htmx scaffold

b1da290 · gmorell · 2026-12-02 16:03

46 files +351 -325
Message
{commit_body(@commit)}

Files changed

modified assets/f/js/src.js
+23 −8
@@ -1,10 +1,25 @@
1 −// Entry point bundled by esbuild into f/js/app.js (loaded by root.html).
2 −//
3 −// htmx powers progressive-enhancement / hx-boost navigation; Alpine drives
4 −// small client-side interactions. Both are registered globally so templates
5 −// can use `hx-*` and `x-*` attributes directly.
1 +// Bundled to f/js/app.js by esbuild (see the Justfile). Importing htmx here
2 +// registers it globally and processes hx-* attributes on load, which is what
3 +// powers hx-boost navigation and the forum's in-place fragments (reactions,
4 +// bookmarks, watch toggles, replies, tag editing, the notification badge).
6 5 import "htmx.org";
7 −import Alpine from "alpinejs";
8 6
9 −window.Alpine = Alpine;
10 −Alpine.start();
7 +// Small toast helper available as window.toast(msg, {kind}) for ad-hoc use.
8 +window.toast = (msg, opts = {}) => {
9 + let host = document.getElementById("toast-host");
10 + if (!host) {
11 + host = document.createElement("div");
12 + host.id = "toast-host";
13 + host.className = "toast toast-end z-50";
14 + document.body.appendChild(host);
15 + }
16 + const alert = document.createElement("div");
17 + alert.className = `alert alert-${opts.kind || "info"} shadow-lg`;
18 + const span = document.createElement("span");
19 + span.textContent = msg;
20 + alert.appendChild(span);
21 + host.appendChild(alert);
22 + const ttl = opts.ttl ?? 4000;
23 + if (ttl > 0) setTimeout(() => alert.remove(), ttl);
24 + return alert;
25 +};
modified assets/package-lock.json
+26 −0
@@ -9,6 +9,7 @@
9 9 "@fontsource/b612-mono": "^5.2.6",
10 10 "@fortawesome/fontawesome-free": "^6.6.0",
11 11 "@tailwindcss/forms": "^0.5.10",
12 + "@tailwindcss/typography": "^0.5.10",
12 13 "daisyui": "^4.12.24",
13 14 "htmx.org": "^2.0.4",
14 15 "tailwindcss": "^3.4.17"
@@ -563,6 +564,31 @@
563 564 "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1 || >= 4.0.0-alpha.20 || >= 4.0.0-beta.1"
564 565 }
565 566 },
567 + "node_modules/@tailwindcss/typography": {
568 + "version": "0.5.20",
569 + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.20.tgz",
570 + "integrity": "sha512-hwbzQuNUfcPvbegQFatVPl/MY/tcM9KLl963hQ5laJKPh81TEZ1+dNG9PirGvcaDBkp+BCshExAyKVPW91dozw==",
571 + "license": "MIT",
572 + "dependencies": {
573 + "postcss-selector-parser": "6.0.10"
574 + },
575 + "peerDependencies": {
576 + "tailwindcss": ">=3.0.0 || >=4.0.0 || insiders"
577 + }
578 + },
579 + "node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser": {
580 + "version": "6.0.10",
581 + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
582 + "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
583 + "license": "MIT",
584 + "dependencies": {
585 + "cssesc": "^3.0.0",
586 + "util-deprecate": "^1.0.2"
587 + },
588 + "engines": {
589 + "node": ">=4"
590 + }
591 + },
566 592 "node_modules/any-promise": {
567 593 "version": "1.3.0",
568 594 "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
modified assets/package.json
+3 −4
@@ -1,17 +1,16 @@
1 1 {
2 + "private": true,
2 3 "dependencies": {
3 4 "@fontsource/b612": "^5.2.6",
4 5 "@fontsource/b612-mono": "^5.2.6",
5 − "@fortawesome/fontawesome-free": "^6.2.1",
6 + "@fortawesome/fontawesome-free": "^6.6.0",
6 7 "@tailwindcss/forms": "^0.5.10",
7 8 "@tailwindcss/typography": "^0.5.10",
8 − "alpinejs": "^3.14.9",
9 9 "daisyui": "^4.12.24",
10 − "htmx-ext-ws": "^2.0.3",
11 10 "htmx.org": "^2.0.4",
12 11 "tailwindcss": "^3.4.17"
13 12 },
14 13 "devDependencies": {
15 − "esbuild": "^0.28.1"
14 + "esbuild": "^0.24.0"
16 15 }
17 16 }
modified assets/tailwind.config.js
+101 −83
@@ -1,104 +1,122 @@
1 −// See the Tailwind configuration guide for advanced usage
2 1 // https://tailwindcss.com/docs/configuration
3 −
4 −let plugin = require('tailwindcss/plugin')
5 −
6 2 module.exports = {
3 + content: [
4 + './f/js/**/*.js',
5 + '../templates/**/*.html',
6 + ],
7 + // Default letter avatars pick a daisyUI semantic color at render time
8 + // (`avatar_color()` in src/avatar.rs -> `bg-{c} text-{c}-content` in
9 + // templates/_avatar.html), so the scanner never sees the full class names.
10 + // Being theme variables, they follow whichever theme is active.
11 + safelist: [
12 + ...["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"]
13 + .flatMap((c) => [`bg-${c}`, `text-${c}-content`]),
14 + ],
7 15 daisyui: {
8 16 themes: [
9 17 {
10 − afterdark: {
11 − "primary": "#7B79B5",
12 − "secondary": "#ACABD5",
13 − "accent": "#fef3c7",
14 − "neutral": "#38357F",
15 − "base-100": "#201D65",
16 − "info": "#7dd3fc",
17 − "success": "#a7f3d0",
18 − "warning": "#fef08a",
19 − "error": "#fca5a5",
20 − },
21 18 her: {
22 − "primary": "#b57979",
23 − "secondary": "#d5abab",
24 − "accent": "#fef3c7",
25 − "neutral": "#7f3535",
26 − "base-100": "#651d1d",
27 − "info": "#7dd3fc",
28 − "success": "#a7f3d0",
29 − "warning": "#fef08a",
30 − "error": "#fca5a5",
19 + "primary": "#b57979", "secondary": "#d5abab", "accent": "#fef3c7",
20 + "neutral": "#7f3535", "base-100": "#651d1d",
21 + "info": "#7dd3fc", "success": "#a7f3d0", "warning": "#fef08a", "error": "#fca5a5",
22 + },
23 + afterdark: {
24 + "primary": "#7B79B5", "secondary": "#ACABD5", "accent": "#fef3c7",
25 + "neutral": "#38357F", "base-100": "#201D65",
26 + "info": "#7dd3fc", "success": "#a7f3d0", "warning": "#fef08a", "error": "#fca5a5",
31 27 },
32 28 forest: {
33 − "primary": "#4ade80",
34 − "secondary": "#86efac",
35 − "accent": "#fef3c7",
36 − "neutral": "#166534",
37 − "base-100": "#052e16",
38 − "info": "#7dd3fc",
39 − "success": "#a7f3d0",
40 − "warning": "#fef08a",
41 − "error": "#fca5a5",
29 + "primary": "#4ade80", "secondary": "#86efac", "accent": "#fef3c7",
30 + "neutral": "#166534", "base-100": "#052e16",
31 + "info": "#7dd3fc", "success": "#a7f3d0", "warning": "#fef08a", "error": "#fca5a5",
42 32 },
43 33 sky: {
44 − "primary": "#38bdf8",
45 − "secondary": "#7dd3fc",
46 − "accent": "#fef3c7",
47 − "neutral": "#0c4a6e",
48 − "base-100": "#082f49",
49 − "info": "#7dd3fc",
50 − "success": "#a7f3d0",
51 − "warning": "#fef08a",
52 − "error": "#fca5a5",
34 + "primary": "#38bdf8", "secondary": "#7dd3fc", "accent": "#fef3c7",
35 + "neutral": "#0c4a6e", "base-100": "#082f49",
36 + "info": "#7dd3fc", "success": "#a7f3d0", "warning": "#fef08a", "error": "#fca5a5",
53 37 },
54 38 clays: {
55 − "primary": "#d97706",
56 − "secondary": "#f59e0b",
57 − "accent": "#fef3c7",
58 − "neutral": "#92400e",
59 − "base-100": "#451a03",
60 − "info": "#7dd3fc",
61 − "success": "#a7f3d0",
62 − "warning": "#fef08a",
63 − "error": "#fca5a5",
39 + "primary": "#d97706", "secondary": "#f59e0b", "accent": "#fef3c7",
40 + "neutral": "#92400e", "base-100": "#451a03",
41 + "info": "#7dd3fc", "success": "#a7f3d0", "warning": "#fef08a", "error": "#fca5a5",
64 42 },
65 43 stones: {
66 − "primary": "#6b7280",
67 − "secondary": "#9ca3af",
68 − "accent": "#fef3c7",
69 − "neutral": "#57534e",
70 − "base-100": "#292524",
71 − "info": "#7dd3fc",
72 − "success": "#a7f3d0",
73 − "warning": "#fef08a",
74 − "error": "#fca5a5",
44 + "primary": "#6b7280", "secondary": "#9ca3af", "accent": "#fef3c7",
45 + "neutral": "#57534e", "base-100": "#292524",
46 + "info": "#7dd3fc", "success": "#a7f3d0", "warning": "#fef08a", "error": "#fca5a5",
47 + },
48 + // The light/dark pair, shared with bigtrippr and dms so the family
49 + // looks the same across apps. These two are what "system" resolves
50 + // to, and the only ones declaring a `color-scheme`, so the browser
51 + // renders form controls and scrollbars to match. Kept after the
52 + // custom themes so the array's first entry -- the one daisyUI puts on
53 + // :root -- is unchanged.
54 + light: {
55 + "color-scheme": "light",
56 + "primary": "oklch(64% 0.076 19)",
57 + "primary-content": "oklch(98% 0.010 19)",
58 + "secondary": "oklch(55% 0.060 19)",
59 + "secondary-content": "oklch(98% 0.010 19)",
60 + "accent": "oklch(0% 0 0)",
61 + "accent-content": "oklch(100% 0 0)",
62 + "neutral": "oklch(44% 0.017 285.786)",
63 + "neutral-content": "oklch(98% 0 0)",
64 + "base-100": "oklch(98% 0.008 24)",
65 + "base-200": "oklch(96% 0.014 24)",
66 + "base-300": "oklch(92% 0.022 24)",
67 + "base-content": "oklch(25% 0.050 24)",
68 + "info": "oklch(62% 0.214 259.815)",
69 + "info-content": "oklch(97% 0.014 254.604)",
70 + "success": "oklch(70% 0.14 182.503)",
71 + "success-content": "oklch(98% 0.014 180.72)",
72 + "warning": "oklch(66% 0.179 58.318)",
73 + "warning-content": "oklch(98% 0.022 95.277)",
74 + "error": "oklch(58% 0.253 17.585)",
75 + "error-content": "oklch(96% 0.015 12.422)",
76 + "--rounded-box": "0.5rem",
77 + "--rounded-btn": "0.25rem",
78 + "--rounded-badge": "0.25rem",
79 + "--border-btn": "1.5px",
80 + },
81 + dark: {
82 + "color-scheme": "dark",
83 + "primary": "oklch(64% 0.076 19)",
84 + "primary-content": "oklch(10% 0.010 19)",
85 + "secondary": "oklch(58% 0.090 19)",
86 + "secondary-content": "oklch(98% 0.010 19)",
87 + // A rose in primary's hue family rather than daisyUI's violet, held
88 + // light enough to read on a base-100 at 30% lightness -- the depth
89 + // comes from hue and chroma, not from going literally dark.
90 + "accent": "oklch(64% 0.135 15)",
91 + "accent-content": "oklch(10% 0.012 15)",
92 + "neutral": "oklch(37% 0.044 257.287)",
93 + "neutral-content": "oklch(98% 0.003 247.858)",
94 + "base-100": "oklch(30.33% 0.016 252.42)",
95 + "base-200": "oklch(25.26% 0.014 253.1)",
96 + "base-300": "oklch(20.15% 0.012 254.09)",
97 + "base-content": "oklch(97.807% 0.029 256.847)",
98 + "info": "oklch(58% 0.158 241.966)",
99 + "info-content": "oklch(97% 0.013 236.62)",
100 + "success": "oklch(60% 0.118 184.704)",
101 + "success-content": "oklch(98% 0.014 180.72)",
102 + "warning": "oklch(66% 0.179 58.318)",
103 + "warning-content": "oklch(98% 0.022 95.277)",
104 + "error": "oklch(58% 0.253 17.585)",
105 + "error-content": "oklch(96% 0.015 12.422)",
106 + "--rounded-box": "0.5rem",
107 + "--rounded-btn": "0.25rem",
108 + "--rounded-badge": "0.25rem",
109 + "--border-btn": "1.5px",
75 110 },
76 111 },
77 112 "lofi",
78 − "black"
79 − ]
80 − },
81 − content: [
82 − './f/js/**/*.js',
83 − '../templates/**/*.html',
84 − ],
85 − theme: {
86 − extend: {
87 − colors: {
88 − cool: '#3b82f6', // blue-500 (0-12.5%)
89 − cyan: '#06b6d4', // cyan-500 (12.5-25%)
90 − good: '#22c55e', // green-500 (25-37.5%)
91 − lime: '#84cc16', // lime-500 (37.5-50%)
92 − warm: '#eab308', // yellow-500 (50-62.5%)
93 − hot: '#f97316', // orange-500 (62.5-75%)
94 − danger: '#ef4444', // red-500 (75-87.5%)
95 − critical: '#b91c1c', // red-700 (87.5-100%)
96 − }
97 − },
113 + "black",
114 + ],
98 115 },
99 116 plugins: [
100 117 require("daisyui"),
101 − require('@tailwindcss/forms'),
102 − require('@tailwindcss/typography'),
103 − ]
118 + require("@tailwindcss/forms"),
119 + // `prose` for rendered markdown post bodies.
120 + require("@tailwindcss/typography"),
121 + ],
104 122 }
modified templates/_notif_item.html
+2 −2
@@ -7,7 +7,7 @@
7 7 <span class="font-medium">{{ n.topic_title }}</span>
8 8 </a>
9 9 {% elif n.kind == "reaction" %}
10 − <a href="/p/{{ n.post_id }}" class="link link-hover">
10 + <a href="/p/{{ n.post_id }}" hx-boost="false" class="link link-hover">
11 11 <span class="font-semibold">{{ n.actor }}</span> reacted to your post{% if n.topic_title %} in
12 12 <span class="font-medium">{{ n.topic_title }}</span>{% endif %}
13 13 </a>
@@ -17,7 +17,7 @@
17 17 </div>
18 18 <span class="opacity-60 text-xs shrink-0" title="{{ n.created_abs }}">{{ n.created }}</span>
19 19 {% if not n.is_read %}
20 − <button hx-post="/notifications/{{ n.id }}/read" hx-target="#notif-{{ n.id }}" hx-swap="outerHTML"
20 + <button hx-post="/notifications/{{ n.id }}/read" hx-target="#notif-{{ n.id }}" hx-select="unset" hx-swap="outerHTML"
21 21 type="button" class="btn btn-ghost btn-xs shrink-0">Mark read</button>
22 22 {% endif %}
23 23 </li>
modified templates/_theme_toggle.html
+4 −4

Click to load diff…

modified templates/admin/categories.html
+3 −3

Click to load diff…

modified templates/admin/category_form.html
+1 −1

Click to load diff…

modified templates/admin/reactions.html
+2 −2

Click to load diff…

modified templates/api_tokens/created.html
+1 −1

Click to load diff…

modified templates/api_tokens/list.html
+1 −1

Click to load diff…

modified templates/auth/invites.html
+10 −19

Click to load diff…

modified templates/auth/login.html
+8 −11

Click to load diff…

modified templates/auth/profile.html
+70 −66

Click to load diff…

modified templates/auth/register.html
+15 −25

Click to load diff…

modified templates/bookmarks.html
+3 −3

Click to load diff…

modified templates/forum/_bookmark_button.html
+1 −1

Click to load diff…

modified templates/forum/_post.html
+2 −2

Click to load diff…

modified templates/forum/_reactions.html
+1 −1

Click to load diff…

modified templates/forum/_topic_list.html
+1 −1

Click to load diff…

modified templates/forum/_topic_tags.html
+1 −1

Click to load diff…

modified templates/forum/_watch_button.html
+1 −1

Click to load diff…

modified templates/forum/category.html
+3 −3

Click to load diff…

modified templates/forum/home.html
+3 −3

Click to load diff…

modified templates/forum/new_topic.html
+1 −1

Click to load diff…

modified templates/forum/topic.html
+3 −2

Click to load diff…

modified templates/forum/topic_deleted.html
+1 −1

Click to load diff…

modified templates/index.html
+1 −1

Click to load diff…

modified templates/notifications.html
+2 −2

Click to load diff…

modified templates/ok.html
+1 −1

Click to load diff…

modified templates/posts/edit.html
+1 −1

Click to load diff…

modified templates/posts/history.html
+1 −1

Click to load diff…

modified templates/reactions.html
+1 −1

Click to load diff…

modified templates/root.html
+50 −65

Click to load diff…

modified templates/search.html
+1 −1

Click to load diff…

modified templates/tag.html
+1 −1

Click to load diff…

modified templates/tags.html
+1 −1

Click to load diff…

Parents: 7d724b1