From da733967654052a95d641530c012b0def53a1eea Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Fri, 8 Aug 2025 23:38:50 +0200 Subject: [PATCH] Add masonry Signed-off-by: Nikolaos Karaolidis --- .gitignore | 3 + Makefile | 23 +- assets/css/photoswipe/photoswipe.css | 417 - assets/js/main.js | 20 + assets/js/photoswipe.js | 10 - .../js/photoswipe/photoswipe-lightbox.esm.js | 2075 ----- assets/js/photoswipe/photoswipe.esm.js | 7335 ----------------- assets/sass/content.scss | 4 + assets/sass/gallery.scss | 45 + assets/sass/hero.scss | 2 +- assets/sass/image.scss | 14 +- assets/sass/list.scss | 4 +- assets/sass/main.scss | 1 + assets/sass/photoswipe.scss | 2 + flake.nix | 1 + layouts/_default/_markup/render-image.html | 2 +- layouts/_default/baseof.html | 10 +- layouts/_default/list.html | 11 +- layouts/_default/single.html | 2 +- layouts/gallery/list.html | 11 + layouts/partials/gallery/hero.html | 0 layouts/partials/gallery/list.html | 25 + .../partials/head/{styles.html => css.html} | 2 +- layouts/partials/head/js.html | 9 + layouts/partials/head/photoswipe.html | 17 - layouts/partials/image.html | 29 - layouts/partials/image/index.html | 21 + layouts/partials/image/reflect.html | 22 + layouts/partials/list/meta.html | 5 + layouts/partials/posts/hero.html | 9 +- layouts/partials/posts/list.html | 2 +- package-lock.json | 104 + package.json | 19 + 33 files changed, 325 insertions(+), 9931 deletions(-) delete mode 100644 assets/css/photoswipe/photoswipe.css create mode 100644 assets/js/main.js delete mode 100644 assets/js/photoswipe.js delete mode 100644 assets/js/photoswipe/photoswipe-lightbox.esm.js delete mode 100644 assets/js/photoswipe/photoswipe.esm.js create mode 100644 assets/sass/gallery.scss create mode 100644 layouts/gallery/list.html create mode 100644 layouts/partials/gallery/hero.html create mode 100644 layouts/partials/gallery/list.html rename layouts/partials/head/{styles.html => css.html} (69%) create mode 100644 layouts/partials/head/js.html delete mode 100644 layouts/partials/head/photoswipe.html delete mode 100644 layouts/partials/image.html create mode 100644 layouts/partials/image/index.html create mode 100644 layouts/partials/image/reflect.html create mode 100644 layouts/partials/list/meta.html create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 6fd12db..9732323 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ hugo.linux # Temporary lock file while building /.hugo_build.lock + +# JavaScript +node_modules/ diff --git a/Makefile b/Makefile index 75b104f..0d041d8 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ -.PHONY: default update update-inter update-photoswipe format +.PHONY: default update update-inter node-modules format -default: +default: node-modules -update: update-inter update-photoswipe format +update: update-inter format update-inter: @tmp_zip=$$(mktemp) && \ @@ -16,19 +16,10 @@ update-inter: cp -r $$tmp_dir/web/{InterVariable*.woff2,Inter-*.woff2} static/font/inter && \ rm -rf $$tmp_zip $$tmp_dir -update-photoswipe: - @tmp_zip=$$(mktemp) && \ - tmp_dir=$$(mktemp -d) && \ - curl -s https://api.github.com/repos/dimsemenov/photoswipe/releases/latest \ - | jq -r '.zipball_url' \ - | xargs curl -Ls -o $$tmp_zip && \ - unzip -q -o $$tmp_zip -d $$tmp_dir && \ - rm -rf assets/js/photoswipe assets/css/photoswipe && \ - mkdir -p assets/js/photoswipe assets/css/photoswipe && \ - cp $$tmp_dir/*PhotoSwipe*/dist/photoswipe-lightbox.esm.js assets/js/photoswipe && \ - cp $$tmp_dir/*PhotoSwipe*/dist/photoswipe.esm.js assets/js/photoswipe && \ - cp $$tmp_dir/*PhotoSwipe*/dist/photoswipe.css assets/css/photoswipe && \ - rm -rf $$tmp_zip $$tmp_dir +node-modules: + npm install && \ + cd ../.. && \ + ln -s ./themes/caldwell/node_modules node_modules format: nix fmt diff --git a/assets/css/photoswipe/photoswipe.css b/assets/css/photoswipe/photoswipe.css deleted file mode 100644 index e0833a7..0000000 --- a/assets/css/photoswipe/photoswipe.css +++ /dev/null @@ -1,417 +0,0 @@ -/*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */ - -.pswp { - --pswp-bg: #000; - --pswp-placeholder-bg: #222; - - --pswp-root-z-index: 100000; - - --pswp-preloader-color: rgba(79, 79, 79, 0.4); - --pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9); - - /* defined via js: - --pswp-transition-duration: 333ms; */ - - --pswp-icon-color: #fff; - --pswp-icon-color-secondary: #4f4f4f; - --pswp-icon-stroke-color: #4f4f4f; - --pswp-icon-stroke-width: 2px; - - --pswp-error-text-color: var(--pswp-icon-color); -} - -/* - Styles for basic PhotoSwipe (pswp) functionality (sliding area, open/close transitions) -*/ - -.pswp { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: var(--pswp-root-z-index); - display: none; - touch-action: none; - outline: 0; - opacity: 0.003; - contain: layout style size; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} - -/* Prevents focus outline on the root element, - (it may be focused initially) */ -.pswp:focus { - outline: 0; -} - -.pswp * { - box-sizing: border-box; -} - -.pswp img { - max-width: none; -} - -.pswp--open { - display: block; -} - -.pswp, -.pswp__bg { - transform: translateZ(0); - will-change: opacity; -} - -.pswp__bg { - opacity: 0.005; - background: var(--pswp-bg); -} - -.pswp, -.pswp__scroll-wrap { - overflow: hidden; -} - -.pswp__scroll-wrap, -.pswp__bg, -.pswp__container, -.pswp__item, -.pswp__content, -.pswp__img, -.pswp__zoom-wrap { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -.pswp__img, -.pswp__zoom-wrap { - width: auto; - height: auto; -} - -.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img { - cursor: -webkit-zoom-in; - cursor: -moz-zoom-in; - cursor: zoom-in; -} - -.pswp--click-to-zoom.pswp--zoomed-in .pswp__img { - cursor: move; - cursor: -webkit-grab; - cursor: -moz-grab; - cursor: grab; -} - -.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active { - cursor: -webkit-grabbing; - cursor: -moz-grabbing; - cursor: grabbing; -} - -/* :active to override grabbing cursor */ -.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img, -.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active, -.pswp__img { - cursor: -webkit-zoom-out; - cursor: -moz-zoom-out; - cursor: zoom-out; -} - -/* Prevent selection and tap highlights */ -.pswp__container, -.pswp__img, -.pswp__button, -.pswp__counter { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.pswp__item { - /* z-index for fade transition */ - z-index: 1; - overflow: hidden; -} - -.pswp__hidden { - display: none !important; -} - -/* Allow to click through pswp__content element, but not its children */ -.pswp__content { - pointer-events: none; -} -.pswp__content > * { - pointer-events: auto; -} - -/* - - PhotoSwipe UI - -*/ - -/* - Error message appears when image is not loaded - (JS option errorMsg controls markup) -*/ -.pswp__error-msg-container { - display: grid; -} -.pswp__error-msg { - margin: auto; - font-size: 1em; - line-height: 1; - color: var(--pswp-error-text-color); -} - -/* -class pswp__hide-on-close is applied to elements that -should hide (for example fade out) when PhotoSwipe is closed -and show (for example fade in) when PhotoSwipe is opened - */ -.pswp .pswp__hide-on-close { - opacity: 0.005; - will-change: opacity; - transition: opacity var(--pswp-transition-duration) - cubic-bezier(0.4, 0, 0.22, 1); - z-index: 10; /* always overlap slide content */ - pointer-events: none; /* hidden elements should not be clickable */ -} - -/* class pswp--ui-visible is added when opening or closing transition starts */ -.pswp--ui-visible .pswp__hide-on-close { - opacity: 1; - pointer-events: auto; -} - -/*