Commit Graph
19 Commits
Author SHA1 Message Date
KenanZhu fec3ace600 chore: migrate mail themes to shared framework and locked upstream inputs
Release / Validate Templates (push) Canceled after 0s
Release / Package & Release (push) Canceled after 0s
Release / Update Latest Release Documentation (push) Canceled after 0s
2026-10-09 18:34:36 +08:00
KenanZhuandClaude 112a061fde feat(preview): responsive topbar with multi-row wrapping
Three-tier responsive system for the navigation bar:

Structure:
- Each label+select pair wrapped in .ctl-group (inline-flex,
  white-space:nowrap) so they never split across rows.
- Separators gain flex-shrink:0;align-self:center for stability.

Breakpoints:
- Default: single row, all controls + hint visible, compact 8px gap
- ≤900px: hint text hidden (first sacrifice for space)
- ≤700px: separators hidden, tighter gaps/padding, smaller fonts
- ≤500px: ultra-compact — min select widths, smaller brand

CSS changes:
- height → min-height so bar grows vertically when wrapping
- flex-wrap:wrap enables natural multi-row flow
- row-gap:4px keeps wrapped rows visually connected
- Separators hidden on narrow screens (gap provides spacing)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-26 14:34:26 +08:00
KenanZhuandClaude f85520a808 feat(preview): convert side panel to floating collapsible overlay with collapsible sections
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-26 14:16:36 +08:00
KenanZhuandClaude 0ad7db124a refactor(preview): remove juice/Node.js, simplify to pure Go dev server with SSE
- Delete tools/server/ (Node.js, juice, inliner.mjs, server.mjs, node_modules)
- Create tools/preview/server.go — pure Go dev server with SSE + file polling
- Rewrite tools/cli/dev.go — start Go server in-process, no Node.js required
- Simplify preview/index.html — View dropdown (Modern/Source), remove Client
  Simulation panel, remove Gmail/Outlook logic, WebSocket → SSE
- Update all 14 documentation files (README, CONTRIBUTING, AGENTS + translations)
  to reflect pure Go dev server and simplified preview

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-23 09:48:04 +08:00
KenanZhuandClaude Opus 4.8 a97a9bea1d chore: stop tracking preview/rendered.js — already in .gitignore
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 18:50:07 +08:00
KenanZhu d8a714b2b5 feat(preview): cross-browser scrollbar, keyboard nav, dev-mode client simulation, docs overhaul
preview/index.html:
- Fix scrollbar CSS: scoped webkit pseudo-elements + standards-track fallback, removed deprecated overflow:overlay
- Keyboard navigation: arrows cycle focus between Theme/Template/Client selects, up/down select within focused dropdown, d/m toggle viewport
- Dev/static mode detection: delayed static warning only when WebSocket absent, WebSocket errors only on disconnect (not on initial fail)
- iframe sandbox: removed static sandbox attr, applied dynamically only in dev mode (file: protocol rejects sandboxed srcdoc)
- Loading fix: removed double-toggle between init and render(); added 5s safety timeout
- Transform clean: returns HTML as-is; CSS stripping moved to server-side
- Dev disclaimer: blue info banner shown on WebSocket connect

tools/server/inliner.mjs:
- Added stripGmail() / stripOutlook() — server-side CSS property stripping for email client simulation

tools/server/server.mjs:
- Fixed WebSocket upgrade: use app.listen() instead of createServer(app).listen()
- Juice post-processing now generates three rendered.js variants (modern/gmail/outlook)
- Initial startup runs juice-only pass (avoids duplicate Go compilation)

docs/ (all 6 languages — en, zh-CN, zh-TW, ja, ko, ru):
- Image size limits: max 50KiB, recommended 10-20KiB
- Dev disclaimer: simulation cannot 100% reproduce every client
- Changed 'accurate' to 'relatively accurate' across all static-mode warnings
- Converted all plain blockquotes to GitHub admonitions ([!WARNING] / [!NOTE])
2026-06-04 16:01:42 +08:00
KenanZhu 4bc9a0667f change(*): update preview index.html and relevant docs files 2026-06-04 15:35:35 +08:00
KenanZhuandClaude Opus 4.8 b09e2f4ef0 style(preview): theme-matching scrollbar colour
Replaced neutral-gray scrollbar with muted-steel-blue
rgba(107,125,153,...) — the page's --muted colour at varying
opacities. Thumb blends with the navy-blue background palette
(#0b1120 / #151d2e / #1e2d45) rather than standing out as
an unrelated grey element.

Page-level + iframe-injected scrollbar: unified palette.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:52:14 +08:00
KenanZhuandClaude Opus 4.8 69f2bbdda1 style(preview): double panel width, fix Chrome/Edge white scrollbar
- Panel width: 270px → 540px (2x) for better parameter display
- Scrollbar fix for Chrome/Edge:
  - Replaced backdrop-filter (not supported on scrollbar pseudo-
    elements) with solid background-color
  - Added !important to override Windows Fluent overlay scrollbar
  - Used standards-track scrollbar-color on :root (Chrome 121+)
  - Neutral gray rgba(128,128,128,.30) — visible on any background
  - Hover: rgba(128,128,128,.45)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:47:43 +08:00
KenanZhuandClaude Opus 4.8 87d1603187 style(preview): cross-browser immersive scrollbar support
Page-level scrollbar:
- WebKit: ::-webkit-scrollbar with 3px width, transparent track,
  6% white thumb → 18% on hover
- Firefox: scrollbar-width:thin + scrollbar-color on #preview-area, #panel
- Legacy Edge/IE: -ms-overflow-style: -ms-autohiding-scrollbar
- Chrome 108+: overflow:overlay via @supports (scrollbar floats,
  no layout shift)

Iframe content (email preview):
- Same cross-browser treatment injected into every rendered template
- Dark email themes get dark scrollbar (rgba(0,0,0,.08))
- Light email themes also covered (6% black is subtle on any bg)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:38:55 +08:00
KenanZhuandClaude Opus 4.8 dc602a7dde fix(preview): stop loader re-appearing when rendered.js is missing
When rendered is null, render() was setting loading.style.display='flex'
before returning — overriding the hide already done in the init error
branch. Now render() silently returns, leaving init to handle the error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:36:42 +08:00
KenanZhuandClaude Opus 4.8 dc2d9de2a4 style(preview): ultra-thin immersive scrollbars
- Global scrollbar: 3px wide, transparent track, 6% white thumb
  that brightens to 15% on hover. Firefox thin scrollbar via
  scrollbar-width:thin. Practically invisible unless needed.
- Iframe content: inject matching scrollbar CSS into every
  rendered email template so the email preview itself has
  the same subtle scrollbar treatment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:34:08 +08:00
KenanZhuandClaude Opus 4.8 39af7f7729 fix(preview): restore truncated HTML closing tags
The _patch.cjs script accidentally stripped </script></body></html>
when replacing the WebSocket section, causing the inline JavaScript
to never terminate — the browser parsed everything as script content
and all functions were undefined.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:29:00 +08:00
KenanZhuandClaude Opus 4.8 fa6c7032dd fix(preview): ship rendered.js, hide loader on missing file
- Remove preview/rendered.js from .gitignore so the project works
  out-of-the-box after clone (no Go required for static preview).
- Hide loading spinner when rendered.js is not found; previously
  the spinner stayed visible forever because render() returned
  early when 'rendered' was null.
- Regenerate rendered.js with all current template fixes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:21:46 +08:00
KenanZhuandClaude Opus 4.8 fe77d52b5b refactor(preview): unified message notification component
Replace ad-hoc #static-notice with reusable .message system:
- .message — base notification bar, spans full width below navbar
- .message-warn — amber/yellow warning (static mode notice)
- .message-error — red error (missing rendered.js, dev disconnect)
- showMessage(html, type) / clearMessages() helpers
- Messages stack vertically in #messages container
- Static notice auto-shown on page load; cleared on dev ws connect
- Dev reconnect/disconnect events shown as error messages

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:17:16 +08:00
KenanZhuandClaude Opus 4.8 dc07b54625 fix(preview): simplify transform, fix static-notice display
- transform(): only Raw mode does HTML escaping. Modern, Gmail, Outlook
  all show the same rendered HTML — in dev mode Juice handles CSS
  inlining server-side; in static mode the notice bar warns.
- static-notice: change display from '' to 'block' to properly
  override CSS rule #static-notice{display:none}. The empty string
  did not override the stylesheet rule in static file:// mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:09:27 +08:00
KenanZhuandClaude Opus 4.8 13c49d2087 fix(preview): static-notice, simplify transform, HTML-safe rendering
- Add static-notice banner: 'Gmail/Outlook simulation is approximate.
  Use dev mode for accurate rendering.' Hidden in dev mode via
  WebSocket try/catch, auto-shown in file:// mode on WS failure.
- Simplify transform(): Gmail/Outlook modes now return same HTML as
  Modern — the dev server with Juice provides actual client sim.
- Add markSafeHTML(): converts RenderedNote/Body/RenderedContent
  from plain string to template.HTML so markdown-rendered HTML
  content is not escaped by Go's html/template engine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 13:51:43 +08:00
KenanZhuandClaude Opus 4.8 0bf982ffb9 refactor(tools): modularize CLI with urfave/cli/v2, externalise template metadata
- Split monolithic build-preview.go into modular packages:
  tools.go (entry), cli/ (list/create/delete/preview commands),
  config/ (JSON loading), preview/ (rendering engine, funcs, locale)
- Extract all template metadata into data/templates_config.json
  as single source of truth — no hardcoded template data in Go
- Replace hand-rolled CLI parsing with github.com/urfave/cli/v2
- Add sensible defaults for --folder (../themes) and --config
  (./data/templates_config.json) — most commands now run bare
- Add type-coercing gt/lt/ge/le template funcs for JSON float64
- Fix AppUrl to gitea.com matching official template convention
- rendered.js now exports __REGISTRY__ and __PARAMS__ alongside
  __RENDERED__ — preview/index.html reads all from single source
- Cross-validate all 11 template data contexts against official
  Gitea source (services/mailer/*.go + templates/mail/*.tmpl)
- Update all docs (README, AGENTS, CONTRIBUTING, 5 languages)
  to reflect new CLI workflow with create scaffolding command

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 12:26:44 +08:00
KenanZhuandClaude Opus 4.8 a2742887e8 chore(init): scaffold Gitea mail templates — 110 templates, 10 visual styles, drop-in deployment
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 18:10:22 +08:00