22 Commits
Author SHA1 Message Date
JimmyandGitHub 08a8b5d767 feat: codeblock improvements (#1328)
* fix: do not show codeblock copy button if clipboard api is not available

related: https://github.com/CaiJimmy/hugo-theme-stack/issues/1309

* fix: remove duplicated codeblock script in main.ts

* feat: add i18n support to codeblock copy button

* feat: add translation strings for codeblock copy button
2026-04-26 13:40:46 +02:00
37f6a77a1a feat: Add jump-to-page dialog and improve pagination logic and styling (#1303)
* feat: add jump-to-page dialog on pagination ellipsis

- Replace pagination windowing algorithm with a tighter 5-item window
  (curr-1 / curr / curr+1, clamped at edges) and hide-on-mobile for
  pages more than 1 step away from the current page
- Ellipsis spans now carry the pagination-jump-trigger class and open
  a native <dialog> on click instead of being static decorations
- Add <dialog id="pagination-jump-dialog"> with number input, Go button,
  and Enter-key hint; data-total / data-first-url / data-format-url
  attributes on <nav> give the JS all it needs to build the target URL
- Add assets/ts/pagination.ts: setupPaginationJump() with Fisher-Yates
  backdrop-click and ESC handling, animated open/close via .closing class
- Wire setupPaginationJump() into Stack.init() in main.ts
- Extend pagination.scss with .hide-on-mobile, .pagination-jump-trigger
  hover style, and the full #pagination-jump-dialog styling + keyframe
  scale-up/scale-down animations
- Add [pagination] i18n keys (jumpToPage / jump / pressEnter) to
  en / zh / zh-hant-tw / zh-hant-hk / ja

* style: align pagination code with upstream conventions

- pagination.html: collapse multi-line span/class/aria attrs to single
  lines; use HTML5 void element syntax; fix hint div indentation
- pagination.scss: 2-space indent → 4-space indent
- pagination.ts: tab indent → 4-space indent; export const arrow fn →
  export function declaration

* chore: update layouts/_partials/pagination.html

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: add aria-labelledby attrributes for better accesibility

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: use { once: true } for the listener and guard against re-entry when .closing is already set.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* style: replace hardcoded values with design tokens and improve dialog UX

- Replace all hardcoded px spacing in .page-link with --spacing-* tokens
- Use @include card-style in #pagination-jump-dialog; override with --shadow-l2
- Replace padding: 24px with var(--card-padding) for responsive dialog padding
- Align header title/subtitle to space-between for cleaner layout
- Replace hardcoded gaps/padding in form with spacing tokens
- Fix input/button border-radius from 8px to 6px (better proportion for 44px height)
- Fix focus ring: use color-mix(accent-color 20%) so it's visible in dark mode
- Add :focus-visible + outline:none to fully suppress native browser outline
- Remove translateY from button hover for more restrained interaction
- Scope transition to specific properties (border-color, box-shadow, background-color)

* chore: add pagination test articles for easier debugging

* style: enhance backdrop animations for pagination jump dialog

* style: replace pagination ellipsis spans with buttons for improved accessibility

* fix: check if browser supports dialog API before continue with pagination jump setup

* fix: retain focus on last active element when closing pagination jump dialog

* fix: style for page-link button (pagination-jump)

* style: adjust width of pagination jump dialog, add container padding

* style: simplify

* refactor: simplify pagination link logic

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jimmy Cai <jimmy@cai.im>
2026-04-26 12:41:31 +02:00
JimmyandGitHub ae0de75992 refactor: remove Vibrant.js (#1236)
* refactor: migrate image color extraction from client-side JavaScript to server-side Hugo.

* fix: check if image exists before accessing .Resource
2026-01-25 23:42:28 +01:00
JimmyandGitHub b1ddad1d22 feat: upgrade to PhotoSwipe v5 (#1233)
* refactor: migrate external resource definitions from YAML to TOML format

* feat: upgrade to PhotoSwipe v5
2026-01-25 23:13:34 +01:00
Jimmy CaiandGitHub b03390d237 Revert "Merge branch 'canary' into master" (#712)
Revert "Merge branch 'canary' into master (#711)"

This reverts commit 8a597a5c9c.
2022-10-29 17:14:19 +02:00
Jimmy CaiandGitHub 8a597a5c9c Merge branch 'canary' into master (#711)
* refactor(i18n): simplify the structure of the translation file

* chore: prepare repository for v4.0.0-alpha

* chore: modify go.mod to v4

* refactor: migrate theme configuration to TOML

* fix: exampleSite not using correct theme

* feat: add favicon from assets folder

* refactor: drop linear grandient background feature

remove node-vibrant from dependencies

* feat: use Hugo's code block render hook to implement code copy button

Now it can have i18n support

* refactor: delete color.ts

* refactor: delete Emoji support post from example site

* refactor: drop support for `hidden` field in front matter

* feat: upgrade to PhotoSwipe v5

* chore: bump the required hugo version to 0.100.0

* refactor: remove PhotoSwipe from external.yaml

* fix: extra margin in search result

* fix: incorrect markdown heading level in example site

* refactor: remove some usages of `default` in template

No longer needed thanks to Hugo's configuration merge

* fix: one line codeblock style in firefox

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/564

* feat: add style to new codeblock

* feat: i18n support for codeblock copy text

* fix(menu): jitter when closing menu

It's caused by flexbox gap property, which can't animate

* fix(search): long text overflows under the Search icon

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/515
2022-10-29 17:02:24 +02:00
Jimmy CaiandGitHub d75dbe2b6e fix: copy code button does not work when line number is enabled (#487)
* fix: copy code button does not work when line number is enabled

* fix pre style

* Add gist shortcode to exampleSite
2022-02-06 20:32:37 +01:00
ZoroarkandGitHub 2b40a32d47 feat(article): Scrollspy for the table of contents (#425)
* Add first try at scrollspy (broken right now)

* Scrollspy actually works now

* Fix VS Code errors by setting JS version

* Recompute offsets when window size changes

* Improve list compatibility for toc active selection

Support up to 6 levels of indentation, properly support <ol>

* Remove debug string

* Add more docs in smoothAnchors

* Use a map to match ids to navigation elements
2022-01-22 10:35:08 +01:00
zhixuanandGitHub ca260db07e fix(shortcode): conflict with gist shortcode (#455) 2022-01-19 01:12:29 +01:00
Jimmy CaiandGitHub 24915a912f feat(article): copy button for highlight block (#295)
This button only shows on highlighted code blocks, because it uses the wrapper div.highlight
2021-08-08 18:15:27 +02:00
Jimmy CaiandGitHub 358e63e799 feat(darkmode): dark mode toggle (#82)
* feat(darkmode): initial support for dark mode toggle

* fix(darkmode): add svg icons

* feat(darkmode): dispatch onColorSchemeChange event

* add head/darkmode

* feat(darkmode); add colorScheme config

* style: remove empty line

* refactor(darkmode): simplify code

* style: add comment for darkmode config

* i18n support for dark mode toggle

* Some renaming
2020-12-23 19:03:40 +01:00
Jimmy CaiandGitHub e606dca404 refactor(article): remove color tag & add custom category color (#75)
closes: https://github.com/CaiJimmy/hugo-theme-stack/issues/71
2020-12-22 19:43:14 +01:00
Jimmy CaiandGitHub 31c42bcfe7 refactor(gallery): rewrite gallery (#79)
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/70
2020-12-22 19:35:37 +01:00
Jimmy CaiandGitHub 54571f036b refactor(ts): import script using new Hugo Module logic (#77)
Allows user to overwrite a specific script.

Note: The required version of Hugo might bump up.
2020-12-21 22:34:54 +01:00
Jimmy Cai b97e86a7a7 style: remove empty line in main.ts 2020-11-06 11:33:33 +01:00
Jimmy Cai 2736fec285 refactor: create createElement.ts 2020-11-06 11:12:48 +01:00
Jimmy Cai a2a49e7537 refactor(scss): remove alert style and script
It is not used in this theme
2020-09-23 13:22:03 +02:00
Jimmy Cai 98804e578d refactor: add copyright info in CSS and JS 2020-09-09 16:28:38 +02:00
Jimmy Cai af487e0f3f feat(style): remove timeago.js, and improve article-time style 2020-09-03 11:47:55 +02:00
Jimmy Cai 6b1e660327 refactor(ts/color): improve code style and change name of some variables for more clarity 2020-08-29 11:43:00 +02:00
Jimmy Cai 32732d4bf1 feat: avoid regenerate color scheme when image URL is changed
Use MD5 as key to identify images, and .Slug as id
2020-08-28 12:11:02 +02:00
Jimmy Cai c698d944e6 🎉 Initial commit 2020-08-22 13:20:08 +02:00