├── .nvmrc ├── CNAME ├── src ├── index.md ├── showcase │ ├── showcase.json │ ├── 23d.png │ ├── elao.png │ ├── dezea.png │ ├── driendl.png │ ├── famsf.png │ ├── gleamer.png │ ├── terrahq.png │ ├── lakrawen.png │ ├── currenthaus.png │ ├── designcampus.png │ ├── fellowship.png │ ├── klikkentheke.png │ ├── kpmg-plan-k.png │ ├── meat-studio.png │ ├── paperdigits.png │ ├── rubysrainbow.png │ ├── undp-goals.png │ ├── felixgaudlitz.png │ ├── herzogdemeuron.png │ ├── katpetroschkat.png │ ├── biennalearte-2024.png │ ├── coop-himmelblau.png │ ├── design-everyday.png │ ├── gradient-journal.png │ ├── hidden-fortress.png │ ├── panasonic-pilsen.png │ ├── rideout-amsterdam.png │ ├── transmedialekunst.png │ ├── vendredi-society.png │ ├── andermatt-realestate.png │ ├── kunstverein-gartenhaus.png │ ├── biennalearchitettura-2023.png │ ├── andermatt-realestate.md │ ├── 23d.md │ ├── elao.md │ ├── terrahq.md │ ├── meat-studio.md │ ├── dezea.md │ ├── gleamer.md │ ├── fellowship.md │ ├── famsf.md │ ├── lakrawen.md │ ├── currenthaus.md │ ├── rubysrainbow.md │ ├── design-everyday.md │ ├── katpetroschkat.md │ ├── klikkentheke.md │ ├── vendredi-society.md │ ├── undp-goals.md │ ├── _showcase.md │ ├── kpmg-plan-k.md │ ├── driendl.md │ ├── biennalearte-2024.md │ ├── designcampus.md │ ├── panasonic-pilsen.md │ ├── paperdigits.md │ ├── biennalearchitettura-2023.md │ ├── hidden-fortress.md │ ├── coop-himmelblau.md │ ├── felixgaudlitz.md │ ├── gradient-journal.md │ ├── rideout-amsterdam.md │ ├── transmedialekunst.md │ ├── herzogdemeuron.md │ ├── kunstverein-gartenhaus.md │ └── README.md ├── _assets │ ├── images │ │ ├── icon.png │ │ ├── swup-demos.mp4 │ │ ├── swup-lifecycle.png │ │ ├── swup-logo-icon.png │ │ ├── swup-lifecycle.sketch │ │ ├── swup-lifecycle-dark.png │ │ ├── swup-logo-icon-square.png │ │ ├── swup-social-preview.png │ │ ├── swup-logo-icon.svg │ │ ├── swup-logo.svg │ │ ├── swup-logo-blue.svg │ │ ├── swup-logo-white.svg │ │ └── swup-logo-no-dots.svg │ ├── components │ │ ├── alpine │ │ │ ├── SwupThemeSwitcher │ │ │ │ └── SwupThemeSwitcher.js │ │ │ ├── MobileNav │ │ │ │ └── MobileNav.js │ │ │ ├── VersionSelect │ │ │ │ └── VersionSelect.js │ │ │ ├── Search │ │ │ │ └── Search.js │ │ │ ├── ColorSchemeSwitcher │ │ │ │ └── ColorSchemeSwitcher.js │ │ │ ├── SearchUI │ │ │ │ └── SearchUI.js │ │ │ ├── Page │ │ │ │ └── Page.js │ │ │ ├── Intro │ │ │ │ └── Intro.js │ │ │ └── TableOfContents │ │ │ │ └── TableOfContents.js │ │ ├── init-alpine.js │ │ └── init-swup.js │ ├── utils.js │ ├── docs.js │ └── scss │ │ ├── inc │ │ ├── version-select.scss │ │ ├── utils.scss │ │ ├── mixins.scss │ │ ├── toc.scss │ │ ├── infoblocks.scss │ │ ├── features.scss │ │ ├── demos.scss │ │ ├── header.scss │ │ ├── tables.scss │ │ ├── showcase.scss │ │ ├── base.scss │ │ ├── breakpoints.scss │ │ ├── intro.scss │ │ ├── search.scss │ │ ├── buttons.scss │ │ ├── nav.scss │ │ └── props.scss │ │ └── docs.scss ├── _includes │ ├── scripts.njk │ ├── color-scheme-switcher.njk │ ├── base.njk │ ├── version-select.njk │ ├── swup-theme-switcher.njk │ ├── mobile-nav.njk │ ├── page-nav.njk │ ├── nav.njk │ ├── showcase-grid.njk │ ├── page.njk │ ├── header.njk │ ├── head.njk │ ├── search.njk │ └── intro.njk ├── _layouts │ ├── default.njk │ ├── front-page.njk │ └── showcase.njk ├── docs │ ├── other │ │ ├── other.md │ │ ├── discussions.md │ │ ├── swup-repositories.md │ │ ├── changelog.md │ │ ├── swup-usage-examples.md │ │ ├── cli.md │ │ ├── browser-support.md │ │ ├── contributions.md │ │ ├── ci-cd.md │ │ └── minimal-reproduction.md │ ├── third-party-plugins │ │ ├── morph-plugin.md │ │ ├── meta-tags-plugin.md │ │ ├── preserve-scroll-plugin.md │ │ └── third-party-plugins.md │ ├── integrations │ │ ├── integrations.md │ │ ├── astro.md │ │ └── alpine.md │ ├── announcements │ │ └── announcements.md │ ├── themes │ │ ├── fade-theme.md │ │ ├── slide-theme.md │ │ ├── overlay-theme.md │ │ ├── themes.md │ │ └── create-theme.md │ ├── api │ │ ├── api.md │ │ ├── properties.md │ │ ├── methods.md │ │ ├── helpers.md │ │ ├── markup.md │ │ └── cache.md │ ├── plugins │ │ ├── gtm-plugin.md │ │ ├── js-plugin.md │ │ ├── forms-plugin.md │ │ ├── ga-plugin.md │ │ ├── scroll-plugin.md │ │ ├── gia-plugin.md │ │ ├── head-plugin.md │ │ ├── scripts-plugin.md │ │ ├── a11y-plugin.md │ │ ├── debug-plugin.md │ │ ├── matomo-plugin.md │ │ ├── fragment-plugin.md │ │ ├── livewire-plugin.md │ │ ├── preload-plugin.md │ │ ├── progress-plugin.md │ │ ├── body-class-plugin.md │ │ ├── parallel-plugin.md │ │ ├── route-name-plugin.md │ │ ├── create-plugin.md │ │ └── plugins.md │ ├── getting-started │ │ ├── showcase.md │ │ ├── videos.md │ │ ├── how-it-works.md │ │ ├── installation.md │ │ ├── example.md │ │ ├── demos.md │ │ ├── reloading-javascript.md │ │ ├── getting-started.md │ │ └── upgrading-v3.md │ └── lifecycle │ │ ├── lifecycle.md │ │ └── visit.md ├── sitemap.njk └── _data │ └── site.js ├── .gitignore ├── .eleventyignore ├── postcss.config.js ├── .prettierignore ├── swup.config.js ├── .vscode └── settings.json ├── .editorconfig ├── .github └── workflows │ ├── test.yml │ └── deploy.yml ├── README.md ├── lib ├── packages │ └── markdown-it-shiki-extra │ │ └── worker.js ├── helpers.js ├── markdown-it-code-enhancements.js └── eleventy-transforms.js ├── package.json ├── CODE_OF_CONDUCT.md └── webpack.config.mjs /.nvmrc: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | swup.js.org -------------------------------------------------------------------------------- /src/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: front-page 3 | permalink: / 4 | --- 5 | -------------------------------------------------------------------------------- /src/showcase/showcase.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": ["showcase"] 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .DS_Store 3 | node_modules 4 | .cache 5 | _packages 6 | -------------------------------------------------------------------------------- /.eleventyignore: -------------------------------------------------------------------------------- 1 | README.md 2 | **/README.md 3 | **/*.template.md 4 | **/_*.md 5 | -------------------------------------------------------------------------------- /src/showcase/23d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/23d.png -------------------------------------------------------------------------------- /src/showcase/elao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/elao.png -------------------------------------------------------------------------------- /src/showcase/dezea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/dezea.png -------------------------------------------------------------------------------- /src/showcase/driendl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/driendl.png -------------------------------------------------------------------------------- /src/showcase/famsf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/famsf.png -------------------------------------------------------------------------------- /src/showcase/gleamer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/gleamer.png -------------------------------------------------------------------------------- /src/showcase/terrahq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/terrahq.png -------------------------------------------------------------------------------- /src/showcase/lakrawen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/lakrawen.png -------------------------------------------------------------------------------- /src/_assets/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/icon.png -------------------------------------------------------------------------------- /src/showcase/currenthaus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/currenthaus.png -------------------------------------------------------------------------------- /src/showcase/designcampus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/designcampus.png -------------------------------------------------------------------------------- /src/showcase/fellowship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/fellowship.png -------------------------------------------------------------------------------- /src/showcase/klikkentheke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/klikkentheke.png -------------------------------------------------------------------------------- /src/showcase/kpmg-plan-k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/kpmg-plan-k.png -------------------------------------------------------------------------------- /src/showcase/meat-studio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/meat-studio.png -------------------------------------------------------------------------------- /src/showcase/paperdigits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/paperdigits.png -------------------------------------------------------------------------------- /src/showcase/rubysrainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/rubysrainbow.png -------------------------------------------------------------------------------- /src/showcase/undp-goals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/undp-goals.png -------------------------------------------------------------------------------- /src/showcase/felixgaudlitz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/felixgaudlitz.png -------------------------------------------------------------------------------- /src/showcase/herzogdemeuron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/herzogdemeuron.png -------------------------------------------------------------------------------- /src/showcase/katpetroschkat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/katpetroschkat.png -------------------------------------------------------------------------------- /src/_assets/images/swup-demos.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/swup-demos.mp4 -------------------------------------------------------------------------------- /src/_includes/scripts.njk: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/showcase/biennalearte-2024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/biennalearte-2024.png -------------------------------------------------------------------------------- /src/showcase/coop-himmelblau.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/coop-himmelblau.png -------------------------------------------------------------------------------- /src/showcase/design-everyday.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/design-everyday.png -------------------------------------------------------------------------------- /src/showcase/gradient-journal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/gradient-journal.png -------------------------------------------------------------------------------- /src/showcase/hidden-fortress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/hidden-fortress.png -------------------------------------------------------------------------------- /src/showcase/panasonic-pilsen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/panasonic-pilsen.png -------------------------------------------------------------------------------- /src/showcase/rideout-amsterdam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/rideout-amsterdam.png -------------------------------------------------------------------------------- /src/showcase/transmedialekunst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/transmedialekunst.png -------------------------------------------------------------------------------- /src/showcase/vendredi-society.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/vendredi-society.png -------------------------------------------------------------------------------- /src/_assets/components/alpine/SwupThemeSwitcher/SwupThemeSwitcher.js: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return {}; 3 | }; 4 | -------------------------------------------------------------------------------- /src/_assets/utils.js: -------------------------------------------------------------------------------- 1 | export function isTouch() { 2 | return !window.matchMedia('(hover: hover)').matches; 3 | } 4 | -------------------------------------------------------------------------------- /src/_assets/images/swup-lifecycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/swup-lifecycle.png -------------------------------------------------------------------------------- /src/_assets/images/swup-logo-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/swup-logo-icon.png -------------------------------------------------------------------------------- /src/showcase/andermatt-realestate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/andermatt-realestate.png -------------------------------------------------------------------------------- /src/showcase/kunstverein-gartenhaus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/kunstverein-gartenhaus.png -------------------------------------------------------------------------------- /src/_assets/images/swup-lifecycle.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/swup-lifecycle.sketch -------------------------------------------------------------------------------- /src/_layouts/default.njk: -------------------------------------------------------------------------------- 1 | {% extends "base.njk" %} 2 | {% block content %} 3 | {% include "page.njk" %} 4 | {% endblock %} 5 | -------------------------------------------------------------------------------- /src/_assets/images/swup-lifecycle-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/swup-lifecycle-dark.png -------------------------------------------------------------------------------- /src/_assets/images/swup-logo-icon-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/swup-logo-icon-square.png -------------------------------------------------------------------------------- /src/_assets/images/swup-social-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/_assets/images/swup-social-preview.png -------------------------------------------------------------------------------- /src/_layouts/front-page.njk: -------------------------------------------------------------------------------- 1 | {% extends "base.njk" %} 2 | {% block content %} 3 | {% include "intro.njk" %} 4 | {% endblock %} 5 | -------------------------------------------------------------------------------- /src/showcase/biennalearchitettura-2023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swup/docs/HEAD/src/showcase/biennalearchitettura-2023.png -------------------------------------------------------------------------------- /src/_layouts/showcase.njk: -------------------------------------------------------------------------------- 1 | {% extends "base.njk" %} 2 | {% block content %} 3 | {% include "showcase-grid.njk" %} 4 | {% endblock %} 5 | -------------------------------------------------------------------------------- /src/showcase/andermatt-realestate.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Andermatt Realestate 3 | url: https://andermatt-realestate.ch/ 4 | date: 2024-02-13 5 | --- 6 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | const postcssPresetEnv = require('postcss-preset-env'); 2 | 3 | module.exports = { 4 | plugins: [ 5 | postcssPresetEnv(), 6 | ] 7 | }; 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Currently there is no way to tell prettier to ignore code blocks in markdown files. 2 | # The next best thing is to ignore .md files alltogether: 3 | **/*.md 4 | -------------------------------------------------------------------------------- /src/showcase/23d.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 23d.1 3 | url: https://23d.one 4 | date: 2021-02-20 5 | credits: 6 | - 7 | name: Anders Svensson 8 | url: https://23d.one 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/elao.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: elao 3 | url: https://www.elao.com/ 4 | date: 2022-11-11 5 | credits: 6 | - 7 | name: elao 8 | url: https://www.elao.com/ 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/terrahq.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Terra 3 | url: https://terrahq.com 4 | date: 2024-02-12 5 | credits: 6 | - 7 | name: Terra 8 | url: https://terrahq.com 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/meat-studio.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Meat 3 | url: https://meat.studio/ 4 | date: 2024-02-15 5 | credits: 6 | - 7 | name: Meat 8 | url: https://meat.studio/ 9 | --- 10 | -------------------------------------------------------------------------------- /src/_assets/docs.js: -------------------------------------------------------------------------------- 1 | import './scss/docs.scss'; 2 | 3 | import initSwup from './components/init-swup.js'; 4 | import initAlpine from './components/init-alpine.js'; 5 | initSwup(); 6 | initAlpine(); 7 | -------------------------------------------------------------------------------- /src/showcase/dezea.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: dezea 3 | url: https://dezea.digital 4 | date: 2023-08-27 5 | credits: 6 | - 7 | name: Michael Bloom 8 | url: https://dezea.digital 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/gleamer.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Gleamer AI 3 | url: https://www.gleamer.ai/ 4 | date: 2023-11-17 5 | credits: 6 | - 7 | name: AREA 17 8 | url: https://area17.com/ 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/fellowship.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Fellowship 3 | url: https://fellowship.xyz/ 4 | date: 2024-02-14 5 | credits: 6 | - 7 | name: Six 8 | url: https://www.madebysix.com 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/famsf.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Fine Arts Museums of SF 3 | url: https://www.famsf.org 4 | date: 2023-11-21 5 | credits: 6 | - 7 | name: AREA 17 8 | url: https://area17.com/ 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/lakrawen.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Luis August Krawen 3 | url: https://l-a-k.com 4 | date: 2024-01-05 5 | credits: 6 | - 7 | name: Rasso Hilber 8 | url: https://rassohilber.com 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/currenthaus.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Current Haus 3 | url: https://currenthaus.com 4 | date: 2021-11-18 5 | credits: 6 | - 7 | name: Current Haus 8 | url: https://currenthaus.com 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/rubysrainbow.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ruby's Rainbow 3 | url: https://rubysrainbow.org/ 4 | date: 2024-07-30 5 | credits: 6 | - 7 | name: Terra HQ 8 | url: https://terrahq.com/ 9 | 10 | --- 11 | -------------------------------------------------------------------------------- /src/showcase/design-everyday.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Design Everyday 3 | url: https://design-everyday.org 4 | date: 2024-09-08 5 | credits: 6 | - 7 | name: Vandasye 8 | url: http://www.vandasye.com/ 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/katpetroschkat.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kat Petroschkat 3 | url: https://katpetroschkat.net/ 4 | date: 2023-11-19 5 | credits: 6 | - 7 | name: Rasso Hilber 8 | url: https://rassohilber.com 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/klikkentheke.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Klikkentheke 3 | url: https://klikkentheke.com 4 | date: 2021-03-12 5 | credits: 6 | - 7 | name: Division Binaural 8 | url: https://divisionbinaural.com 9 | --- 10 | -------------------------------------------------------------------------------- /src/showcase/vendredi-society.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Vendredi Society 3 | url: https://vendredi-society.com/ 4 | date: 2024-04-03 5 | credits: 6 | - 7 | name: Vendredi Society 8 | url: https://vendredi-society.com/ 9 | --- 10 | -------------------------------------------------------------------------------- /src/docs/other/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Other 4 | eleventyNavigation: 5 | key: Other 6 | order: 10 7 | description: Some more stuff about swup 8 | permalink: /other/ 9 | --- 10 | 11 | # More stuff about swup 12 | -------------------------------------------------------------------------------- /src/showcase/undp-goals.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: UNDP Action Goals 3 | url: https://feature.undp.org/from-hope-action-global-goals/ 4 | date: 2023-09-18 5 | credits: 6 | - 7 | name: Andrés Clúa 8 | url: https://andresclua.com 9 | --- 10 | -------------------------------------------------------------------------------- /src/docs/other/discussions.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Discussions 4 | eleventyNavigation: 5 | key: Discussions 6 | parent: Other 7 | order: 7 8 | url: https://github.com/swup/swup/discussions 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/docs/other/swup-repositories.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Swup repositories 4 | eleventyNavigation: 5 | key: Swup repositories 6 | parent: Other 7 | order: 6 8 | url: https://github.com/swup 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/docs/other/changelog.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Changelog 4 | eleventyNavigation: 5 | key: Changelog 6 | parent: Other 7 | order: 5 8 | url: https://github.com/swup/swup/blob/main/CHANGELOG.md 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/docs/other/swup-usage-examples.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Sites using swup 4 | eleventyNavigation: 5 | key: Sites using swup 6 | parent: Other 7 | order: 5 8 | url: https://github.com/swup/swup/discussions/333 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/showcase/_showcase.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Example Showcase 3 | url: https://example.net 4 | date: 2024-04-05 5 | credits: 6 | - 7 | name: Freelancer 8 | url: https://freelancer.net 9 | - 10 | name: Agency 11 | url: https://agency.net 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/kpmg-plan-k.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: KPMG Plan-K 3 | url: https://www.plan-k.cz/en/ 4 | date: 2020-11-17 5 | credits: 6 | - 7 | name: Georgy Marchuk 8 | url: https://gmrchk.com/ 9 | - 10 | name: Giant 11 | url: https://www.giant.cz/ 12 | --- 13 | -------------------------------------------------------------------------------- /src/docs/third-party-plugins/morph-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Morph Plugin 4 | eleventyNavigation: 5 | key: Morph Plugin 6 | parent: Third-Party Plugins 7 | order: 1 8 | url: https://github.com/daun/swup-morph-plugin 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/showcase/driendl.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: driendl architects 3 | url: https://driendl.at 4 | date: 2023-11-29 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Bueronardin 11 | url: https://bueronardin.com 12 | --- 13 | -------------------------------------------------------------------------------- /src/docs/integrations/integrations.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Integrations 4 | eleventyNavigation: 5 | key: Integrations 6 | order: 5 7 | url: /plugins/#official-integrations 8 | description: List of available official integrations 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/showcase/biennalearte-2024.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Biennale Arte 2024 3 | url: https://biennalearte.at/ 4 | date: 2023-12-10 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Soybot 11 | url: https://soybot.org 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/designcampus.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Design Campus 3 | url: https://designcampus.org 4 | date: 2023-11-24 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Bueronardin 11 | url: https://bueronardin.com 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/panasonic-pilsen.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Panasonic Pilsen 3 | url: https://www.plan-k.cz/en/ 4 | date: 2020-12-26 5 | credits: 6 | - 7 | name: Georgy Marchuk 8 | url: https://gmrchk.com/ 9 | - 10 | name: Giant 11 | url: https://www.giant.cz/ 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/paperdigits.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Paper Digits 3 | url: https://paperdigits.nl 4 | date: 2023-12-10 5 | credits: 6 | - 7 | name: Cyd Stumpel 8 | url: https://cydstumpel.nl 9 | - 10 | name: Stu Stu Studio 11 | url: hhttps://www.stustu.studio 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/biennalearchitettura-2023.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Partezipazione 3 | url: https://labiennale2023.at 4 | date: 2023-11-22 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Soybot 11 | url: https://soybot.org 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/hidden-fortress.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hidden Fortress 3 | url: https://hidden-fortress.com 4 | date: 2024-01-26 5 | credits: 6 | - 7 | name: Rasso Hilber 8 | url: https://rassohilber.com 9 | - 10 | name: Basics09 11 | url: https://basics09.de 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/coop-himmelblau.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Coop Himmeb(l)au 3 | url: https://coop-himmelblau.at 4 | date: 2023-11-30 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Bueronardin 11 | url: https://bueronardin.com 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/felixgaudlitz.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Felix Gaudlitz 3 | url: https://felixgaudlitz.com 4 | date: 2020-12-27 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Fondazione Europa 11 | url: https://fondazione.biz 12 | --- 13 | -------------------------------------------------------------------------------- /src/docs/third-party-plugins/meta-tags-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Meta Tags Plugin 4 | eleventyNavigation: 5 | key: Meta Tags Plugin 6 | parent: Third-Party Plugins 7 | order: 2 8 | url: https://github.com/Accudio/swup-meta-tags-plugin 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/showcase/gradient-journal.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Gradient Journal 3 | url: https://gradient-journal.net 4 | date: 2023-11-15 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Studio Es 11 | url: https://www.studio-es.at/ 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/rideout-amsterdam.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Ride Out Amsterdam 3 | url: https://rideout.amsterdam 4 | date: 2024-04-01 5 | credits: 6 | - 7 | name: Cyd Stumpel 8 | url: https://cydstumpel.nl 9 | - 10 | name: Stu Stu Studio 11 | url: hhttps://www.stustu.studio 12 | --- 13 | -------------------------------------------------------------------------------- /src/showcase/transmedialekunst.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Transmediale Kunst 3 | url: https://transmedialekunst.com 4 | date: 2023-11-19 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Fondazione Europa 11 | url: https://fondazione.biz 12 | --- 13 | -------------------------------------------------------------------------------- /swup.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | swup: { 3 | animationSelector: '[class*="swup-transition-"]', 4 | containers: ['#swup'], 5 | }, 6 | validate: { 7 | stylesExpectedToChange: ['opacity', 'transform'], 8 | sitemap: '_site/sitemap.xml', 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /src/showcase/herzogdemeuron.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Herzog & de Meuron 3 | url: https://www.herzogdemeuron.com/ 4 | date: 2023-11-20 5 | credits: 6 | - 7 | name: Rasso Hilber 8 | url: https://rassohilber.com 9 | - 10 | name: fertig design 11 | url: https://www.fertigdesign.com 12 | --- 13 | -------------------------------------------------------------------------------- /src/docs/third-party-plugins/preserve-scroll-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Preserve Scroll Plugin 4 | eleventyNavigation: 5 | key: Preserve Scroll Plugin 6 | parent: Third-Party Plugins 7 | order: 3 8 | url: https://github.com/ngsctt/SwupPreserveScrollPlugin 9 | permalink: false 10 | --- 11 | -------------------------------------------------------------------------------- /src/showcase/kunstverein-gartenhaus.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kunstverein Gartenhaus 3 | url: https://kunstverein-gartenhaus.com/ 4 | date: 2023-11-11 5 | credits: 6 | - 7 | name: Philipp Daun 8 | url: https://philippdaun.net 9 | - 10 | name: Fondazione Europa 11 | url: https://fondazione.biz 12 | --- 13 | -------------------------------------------------------------------------------- /src/docs/announcements/announcements.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Announcements 4 | eleventyNavigation: 5 | key: Announcements 6 | order: -1 7 | description: Announcements for the swup project 8 | permalink: /announcements/ 9 | --- 10 | 11 | # Announcements 12 | 13 | Announcements for the swup project. 14 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/MobileNav/MobileNav.js: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return { 3 | navHTML: '', 4 | isOpen: false, 5 | init() { 6 | this.navHTML = document.querySelector('.nav').innerHTML; 7 | }, 8 | open() { 9 | this.isOpen = true; 10 | }, 11 | close() { 12 | this.isOpen = false; 13 | } 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /src/_includes/color-scheme-switcher.njk: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // @see https://marketplace.visualstudio.com/items?itemName=vunguyentuan.vscode-css-variables#i-want-to-add-files-in-node_modules-folder 2 | { 3 | "cssVariables.lookupFiles": [ 4 | "**/*.css", 5 | "**/*.scss", 6 | "**/*.sass", 7 | "**/*.less", 8 | "node_modules/open-props/open-props.min.css" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/VersionSelect/VersionSelect.js: -------------------------------------------------------------------------------- 1 | import tippy from 'tippy.js'; 2 | 3 | export default () => { 4 | return { 5 | init() { 6 | tippy(this.$refs.button, { 7 | content: this.$refs.options.content, 8 | allowHTML: true, 9 | interactive: true, 10 | trigger: 'click' 11 | // theme: 'light', 12 | }); 13 | } 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | max_line_length = 100 9 | 10 | [*.{js,mjs,ts}] 11 | indent_style = tab 12 | indent_size = 4 13 | 14 | [*.{json,md,yaml,yml}] 15 | indent_style = space 16 | indent_size = 2 17 | 18 | [*.md] 19 | trim_trailing_whitespace = false 20 | -------------------------------------------------------------------------------- /src/docs/other/cli.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: CLI 4 | eleventyNavigation: 5 | key: CLI 6 | order: 8 7 | parent: Other 8 | description: A command-line interface (CLI) to help develop swup sites, plugins and themes. 9 | permalink: /cli/ 10 | repo_link: https://github.com/swup/cli/ 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/themes/fade-theme.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Fade Theme 4 | eleventyNavigation: 5 | key: Fade Theme 6 | parent: Themes 7 | order: 1 8 | description: A swup theme for fade animations 9 | permalink: /themes/fade-theme/ 10 | repo_link: https://github.com/swup/fade-theme 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/api/api.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: API 4 | eleventyNavigation: 5 | key: API 6 | order: 2 7 | description: Methods and helpers available on the swup instance 8 | permalink: /api/ 9 | --- 10 | 11 | # API 12 | 13 | The swup instance can be used to call additional methods and helpers. 14 | 15 | If installed, the [debug plugin](/plugins/debug-plugin/) can optionally expose the swup instance at `window.swup`. 16 | -------------------------------------------------------------------------------- /src/docs/plugins/gtm-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: GTM Plugin 4 | eleventyNavigation: 5 | key: GTM Plugin 6 | parent: Integrations 7 | order: 5 8 | description: Plugin to trigger GTM page view events 9 | permalink: /plugins/gtm-plugin/ 10 | repo_link: https://github.com/swup/gtm-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/js-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: JS Plugin 4 | eleventyNavigation: 5 | key: JS Plugin 6 | parent: Plugins 7 | order: 12 8 | description: A swup plugin for managing animations in JS 9 | permalink: /plugins/js-plugin/ 10 | repo_link: https://github.com/swup/js-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/forms-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Forms Plugin 4 | eleventyNavigation: 5 | key: Forms Plugin 6 | parent: Plugins 7 | order: 6 8 | description: A swup plugin for submitting forms 9 | permalink: /plugins/forms-plugin/ 10 | repo_link: https://github.com/swup/forms-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/ga-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: GA Plugin 4 | eleventyNavigation: 5 | key: GA Plugin 6 | parent: Integrations 7 | order: 3 8 | description: A swup plugin for integrating Google Analytics 9 | permalink: /plugins/ga-plugin/ 10 | repo_link: https://github.com/swup/ga-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/themes/slide-theme.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Slide Theme 4 | eleventyNavigation: 5 | key: Slide Theme 6 | parent: Themes 7 | order: 2 8 | description: A swup theme for slide and fade animations 9 | permalink: /themes/slide-theme/ 10 | repo_link: https://github.com/swup/slide-theme 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/scroll-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Scroll Plugin 4 | eleventyNavigation: 5 | key: Scroll Plugin 6 | parent: Plugins 7 | order: 20 8 | description: A swup plugin for smooth scrolling 9 | permalink: /plugins/scroll-plugin/ 10 | repo_link: https://github.com/swup/scroll-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/gia-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Gia Plugin 4 | eleventyNavigation: 5 | key: Gia Plugin 6 | parent: Integrations 7 | order: 4 8 | description: A swup plugin for integrating Gia frontend components 9 | permalink: /plugins/gia-plugin/ 10 | repo_link: https://github.com/swup/gia-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/head-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Head Plugin 4 | eleventyNavigation: 5 | key: Head Plugin 6 | parent: Plugins 7 | order: 11 8 | description: A swup plugin for updating the contents of the head tag 9 | permalink: /plugins/head-plugin/ 10 | repo_link: https://github.com/swup/head-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/scripts-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Scripts Plugin 4 | eleventyNavigation: 5 | key: Scripts Plugin 6 | parent: Plugins 7 | order: 19 8 | description: A swup plugin for re-evaluating scripts 9 | permalink: /plugins/scripts-plugin/ 10 | repo_link: https://github.com/swup/scripts-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/a11y-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Accessibility Plugin 4 | eleventyNavigation: 5 | key: Accessibility Plugin 6 | parent: Plugins 7 | order: 1 8 | description: A swup plugin for enhanced accessibility 9 | permalink: /plugins/a11y-plugin/ 10 | repo_link: https://github.com/swup/a11y-plugin/ 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/debug-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Debug Plugin 4 | eleventyNavigation: 5 | key: Debug Plugin 6 | parent: Plugins 7 | order: 5 8 | description: A swup plugin for debugging and helping in development 9 | permalink: /plugins/debug-plugin/ 10 | repo_link: https://github.com/swup/debug-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/matomo-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Matomo Plugin 4 | eleventyNavigation: 5 | key: Matomo Plugin 6 | parent: Integrations 7 | order: 7 8 | description: A swup plugin for integrating Matomo analytics 9 | permalink: /plugins/matomo-plugin/ 10 | repo_link: https://github.com/swup/matomo-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/themes/overlay-theme.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Overlay Theme 4 | eleventyNavigation: 5 | key: Overlay Theme 6 | parent: Themes 7 | order: 3 8 | description: A swup theme for showing an overlay during animations 9 | permalink: /themes/overlay-theme/ 10 | repo_link: https://github.com/swup/overlay-theme 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/fragment-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Fragment Plugin 4 | eleventyNavigation: 5 | key: Fragment Plugin 6 | parent: Plugins 7 | order: 7 8 | description: A swup plugin for replacing dynamic fragments 9 | permalink: /plugins/fragment-plugin/ 10 | repo_link: https://github.com/swup/fragment-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/livewire-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Livewire Plugin 4 | eleventyNavigation: 5 | key: Livewire Plugin 6 | parent: Integrations 7 | order: 6 8 | description: A swup plugin for integrating Laravel Livewire 9 | permalink: /plugins/livewire-plugin/ 10 | repo_link: https://github.com/swup/livewire-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/preload-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Preload Plugin 4 | eleventyNavigation: 5 | key: Preload Plugin 6 | parent: Plugins 7 | order: 16 8 | description: A swup plugin for preloading pages to speed up navigation 9 | permalink: /plugins/preload-plugin/ 10 | repo_link: https://github.com/swup/preload-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/progress-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Progress Bar Plugin 4 | eleventyNavigation: 5 | key: Progress Bar Plugin 6 | parent: Plugins 7 | order: 17 8 | description: A swup plugin for displaying a progress bar 9 | permalink: /plugins/progress-plugin/ 10 | repo_link: https://github.com/swup/progress-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/body-class-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Body Class Plugin 4 | eleventyNavigation: 5 | key: Body Class Plugin 6 | parent: Plugins 7 | order: 2 8 | description: A swup plugin for updating the body classname 9 | permalink: /plugins/body-class-plugin/ 10 | repo_link: https://github.com/swup/body-class-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/parallel-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Parallel Plugin 4 | eleventyNavigation: 5 | key: Parallel Plugin 6 | parent: Plugins 7 | order: 15 8 | description: A swup plugin for running the in and out animations in parallel 9 | permalink: /plugins/parallel-plugin/ 10 | repo_link: https://github.com/swup/parallel-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/docs/plugins/route-name-plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Route Name Plugin 4 | eleventyNavigation: 5 | key: Route Name Plugin 6 | parent: Plugins 7 | order: 18 8 | description: A swup plugin for named routes and route-based animation classes 9 | permalink: /plugins/route-name-plugin/ 10 | repo_link: https://github.com/swup/route-name-plugin 11 | --- 12 | 13 | ⚠️ This page content is loaded from the repository README.md file. Edit the file in the source repository. 14 | -------------------------------------------------------------------------------- /src/sitemap.njk: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /sitemap.xml 3 | eleventyExcludeFromCollections: true 4 | --- 5 | 6 | 7 | {%- for page in collections.all %} 8 | {%- if page.data.permalink %} 9 | 10 | {{ site.url }}{{ page.url | url }} 11 | {{ page.date.toISOString() }} 12 | 13 | {%- endif -%} 14 | {% endfor %} 15 | 16 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/Search/Search.js: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return { 3 | isOpen: false, 4 | metaKey: navigator.platform.indexOf('Mac') === 0 ? '⌘' : 'Ctrl+', 5 | onKeyDown(e) { 6 | if (e.key === '/' || (e.key === 'k' && (e.ctrlKey || e.metaKey))) { 7 | e.preventDefault(); 8 | this.open(); 9 | } 10 | }, 11 | open() { 12 | this.isOpen = true; 13 | this.$dispatch('search-opened'); 14 | }, 15 | close() { 16 | this.isOpen = false; 17 | } 18 | }; 19 | }; 20 | -------------------------------------------------------------------------------- /src/docs/getting-started/showcase.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: showcase 3 | title: Showcase 4 | eleventyNavigation: 5 | key: Showcase 6 | parent: Getting Started 7 | order: 5 8 | description: Sites using swup 9 | permalink: /getting-started/showcase/ 10 | --- 11 | 12 | # Showcase 13 | 14 | A small selection of sites using swup to enhance their navigation experience. 15 | 16 | Want to share a site you've built? 17 | [Submit it to the showcase](https://github.com/swup/docs/blob/main/src/showcase/README.md). 18 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/ColorSchemeSwitcher/ColorSchemeSwitcher.js: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return { 3 | // Find this function in `head.njk` 4 | scheme: window.getColorSchemePreference(), 5 | switchTheme() { 6 | this.scheme = this.scheme === 'light' ? 'dark' : 'light'; 7 | if (localStorage) localStorage.setItem('color-scheme', this.scheme); 8 | document.documentElement.classList.remove('dark', 'light'); 9 | document.documentElement.classList.add(this.scheme); 10 | } 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /src/_includes/base.njk: -------------------------------------------------------------------------------- 1 | {# Base template for the layouts (front-page, default) #} 2 | 3 | 4 | {% include "head.njk" %} 5 | 6 | {% include "header.njk" %} 7 |
8 | {% include "nav.njk" %} 9 |
10 | {# This renders the actual content of the layout #} 11 | {% block content %}{% endblock %} 12 |
13 |
14 | {% include "scripts.njk" %} 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/_data/site.js: -------------------------------------------------------------------------------- 1 | module.exports = function () { 2 | return { 3 | title: 'swup', 4 | description: 5 | 'Versatile and extensible page transition library for server-rendered websites', 6 | url: process.env.SITE_URL || 'https://swup.js.org', 7 | ga_tracking: 'UA-65615068-6', 8 | currentVersion: 'v4', 9 | versions: [ 10 | { 11 | label: 'swup v4 (current)', 12 | url: process.env.SITE_URL || 'https://swup.js.org', 13 | isCurrent: true 14 | }, 15 | { 16 | label: 'swup v3', 17 | url: 'https://v3.swup.js.org' 18 | } 19 | ] 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | 3 | on: 4 | push: 5 | branches: ["main", "next"] 6 | pull_request: 7 | workflow_dispatch: 8 | 9 | jobs: 10 | checkout-and-test: 11 | name: Run tests 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out code 15 | uses: actions/checkout@v3 16 | - uses: actions/setup-node@v3 17 | with: 18 | node-version: 18 19 | - name: install 20 | run: npm ci 21 | - name: playwright install 22 | run: npx playwright install 23 | - name: Run swup validate tests 24 | run: npm run test 25 | -------------------------------------------------------------------------------- /src/_includes/version-select.njk: -------------------------------------------------------------------------------- 1 |
2 | 7 | 16 |
17 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/version-select.scss: -------------------------------------------------------------------------------- 1 | .version-select_label { 2 | font-size: 0.95rem; 3 | display: flex; 4 | align-items: center; 5 | justify-content: center; 6 | font-weight: 500; 7 | @include bp(m) { 8 | font-size: 0.8rem; 9 | } 10 | .feather { 11 | width: 0.9em; 12 | margin-right: -0.3em; 13 | } 14 | } 15 | 16 | .version-select_options { 17 | margin-block: 0.2em; 18 | margin-inline: -0.5em; 19 | padding: 0; 20 | list-style: none; 21 | a { 22 | display: block; 23 | padding: 0.5em 1em; 24 | white-space: nowrap; 25 | font-size: 0.9em; 26 | @include mixins.hover { 27 | background: rgb(0 0 0 / 0.1); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/docs/third-party-plugins/third-party-plugins.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Third-Party Plugins 4 | eleventyNavigation: 5 | key: Third-Party Plugins 6 | order: 7 7 | description: List of external plugins created by awesome people around the web 8 | permalink: /third-party-plugins/ 9 | --- 10 | 11 | # Third-Party Plugins 12 | 13 | These are plugins that swup users have created themselves. Keep in mind that these are 14 | external projects and any questions or issues need to be directed at the authors directly. 15 | 16 | To have your plugin listed here, create an issue or a PR on the 17 | [swup docs](https://github.com/swup/swup) repository. 18 | -------------------------------------------------------------------------------- /src/_includes/swup-theme-switcher.njk: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/utils.scss: -------------------------------------------------------------------------------- 1 | html { 2 | color-scheme: light dark; 3 | } 4 | 5 | img, 6 | video, 7 | svg { 8 | display: block; 9 | max-width: 100%; 10 | } 11 | 12 | iframe { 13 | display: block; 14 | background: transparent; 15 | border-radius: var(--radius-1); 16 | overflow: hidden; 17 | border: 0; 18 | } 19 | 20 | /* 21 | * Hide things visually, still shwo them to screen readers 22 | */ 23 | .sr-only { 24 | position: absolute !important; 25 | left: -10000px !important; 26 | top: auto !important; 27 | width: 1px !important; 28 | height: 1px !important; 29 | overflow: hidden !important; 30 | } 31 | 32 | html.dark .light-only, 33 | html.light .dark-only { 34 | display: none; 35 | } 36 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin hover($applyToFocusVisible: false) { 2 | &:not(.is-disabled):not(:disabled) { 3 | @media all and (hover: hover) { 4 | &:hover { 5 | @content; 6 | } 7 | } 8 | &.is-active { 9 | @content; 10 | } 11 | &:active { 12 | @content; 13 | } 14 | @if $applyToFocusVisible == true { 15 | &:focus-visible { 16 | @content; 17 | } 18 | } 19 | } 20 | } 21 | 22 | @mixin hoverSupport { 23 | @media all and (hover: hover) { 24 | @content; 25 | } 26 | } 27 | 28 | @mixin aspectRatio($width, $height) { 29 | width: 100%; 30 | padding-bottom: calc(100% / (#{$width} / #{$height})); 31 | @supports (aspect-ratio: 1 / 1) { 32 | padding-bottom: 0; 33 | aspect-ratio: #{$width} / #{$height}; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/_includes/mobile-nav.njk: -------------------------------------------------------------------------------- 1 |
2 | 3 | 7 | 8 | 26 | 27 |
28 | -------------------------------------------------------------------------------- /src/docs/integrations/astro.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Astro Integration 4 | eleventyNavigation: 5 | key: Astro 6 | parent: Integrations 7 | order: 1 8 | description: Official Astro integration 9 | permalink: /integrations/astro/ 10 | --- 11 | 12 | # Astro Integration 13 | 14 | Astro and swup are a great fit. Where Astro manages the rendering of your site, swup takes over 15 | and adds smooth page transitions, smart preloading and caching on the client side. 16 | 17 | Check out the [official Astro integration for swup](https://github.com/swup/astro) 18 | for getting started quickly. 19 | 20 | ```js 21 | // astro.config.mjs 22 | import { defineConfig } from 'astro/config'; 23 | import swup from '@swup/astro'; 24 | 25 | export default defineConfig({ 26 | integrations: [swup()] 27 | }); 28 | ``` 29 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/toc.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * TOC 3 | */ 4 | .toc { 5 | height: calc(100vh - var(--header-height)); 6 | height: calc(100svh - var(--header-height)); 7 | position: sticky; 8 | top: var(--header-height); 9 | overflow: hidden; 10 | --_items-spacing: 0.25em; 11 | @include bp(xl, max) { 12 | display: none; 13 | } 14 | } 15 | .toc_title { 16 | margin-block: 0; 17 | } 18 | .toc_nav { 19 | margin-block: var(--_items-spacing) 0; 20 | padding-inline-end: 1rem; 21 | font-size: 0.8rem; 22 | } 23 | .toc_nav ol { 24 | margin: 0; 25 | padding: 0; 26 | list-style: none; 27 | } 28 | .toc_nav ol ol { 29 | padding-left: 1.5em; 30 | } 31 | .toc_nav a { 32 | display: inline-block; 33 | padding-block: var(--_items-spacing); 34 | color: var(--color-transparent-3); 35 | @include mixins.hover { 36 | color: var(--color); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/_includes/page-nav.njk: -------------------------------------------------------------------------------- 1 | {% set nav = collections.all | getPreviousAndNextPage %} 2 | 20 | -------------------------------------------------------------------------------- /src/_assets/scss/docs.scss: -------------------------------------------------------------------------------- 1 | @use './inc/mixins'; 2 | @use './inc/breakpoints' as *; 3 | 4 | /* 5 | * Modern Normalize 6 | * @see https://github.com/sindresorhus/modern-normalize 7 | */ 8 | @import 'modern-normalize/modern-normalize'; 9 | 10 | /* 11 | * Tippy styles 12 | * @see https://atomiks.github.io/tippyjs/v6/themes/ 13 | */ 14 | @import 'tippy.js/dist/tippy.css'; 15 | @import 'tippy.js/themes/light.css'; 16 | 17 | /* 18 | * Finally, our actual styles :) 19 | */ 20 | @import './inc/props'; 21 | @import './inc/utils'; 22 | @import './inc/base'; 23 | @import './inc/buttons'; 24 | @import './inc/intro'; 25 | @import './inc/header'; 26 | @import './inc/search'; 27 | @import './inc/nav'; 28 | @import './inc/toc'; 29 | @import './inc/tables'; 30 | @import './inc/features'; 31 | @import './inc/showcase'; 32 | @import './inc/demos'; 33 | @import './inc/infoblocks'; 34 | @import './inc/version-select'; 35 | @import './inc/page'; 36 | -------------------------------------------------------------------------------- /src/docs/lifecycle/lifecycle.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Lifecycle 4 | eleventyNavigation: 5 | key: Lifecycle 6 | order: 1 7 | description: 8 | permalink: /lifecycle/ 9 | --- 10 | 11 | # Lifecycle 12 | 13 | Swup handles the complete lifecycle of a page visit: it will intercept link clicks, load the new 14 | page in the background, replace the content and animate between the old and the new page. 15 | 16 | To change how swup will transition to the new page, you can: 17 | 18 | - use lifecycle [hooks](/hooks/) to trigger custom code 19 | - update the [visit object](/visit/) to custimize the current transition 20 | 21 | ## Lifecycle Diagram 22 | 23 | [![Swup Lifecycle Diagram](/assets/images/swup-lifecycle.svg){class="light-only wide-image"}](/assets/images/swup-lifecycle.svg) 24 | [![Swup Lifecycle Diagram](/assets/images/swup-lifecycle-dark.svg){class="dark-only wide-image"}](/assets/images/swup-lifecycle.svg) 25 | -------------------------------------------------------------------------------- /src/docs/themes/themes.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Themes 4 | eleventyNavigation: 5 | key: Themes 6 | order: 6 7 | description: List of official themes 8 | permalink: /themes/ 9 | --- 10 | 11 | # Themes 12 | 13 | Themes are special plugins with predefined animations to get up and running quickly. 14 | 15 | ## Try them out 16 | 17 | Get a live preview of the official themes by clicking the buttons below. 18 | 19 |
20 | 23 | 26 | 29 |
30 | -------------------------------------------------------------------------------- /src/_includes/nav.njk: -------------------------------------------------------------------------------- 1 | 33 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/SearchUI/SearchUI.js: -------------------------------------------------------------------------------- 1 | export default () => { 2 | const postsPerPage = 10; 3 | 4 | return { 5 | term: '', 6 | results: [], 7 | isSearching: false, 8 | init() { 9 | this.$watch('term', this.search.bind(this)); 10 | Alpine.effect(async () => { 11 | if (!this.isOpen) return; 12 | await this.$nextTick(); 13 | this.$refs.input.focus(); 14 | }); 15 | }, 16 | reset() { 17 | this.results = []; 18 | this.isSearching = false; 19 | this.term = ''; 20 | }, 21 | async search(term) { 22 | if (term.trim().length < 2) { 23 | this.results = []; 24 | this.isSearching = false; 25 | return; 26 | } 27 | this.isSearching = true; 28 | const pagefind = await import(/* webpackIgnore: true */ '/pagefind/pagefind.js'); 29 | const search = await pagefind.search(term); 30 | const results = await Promise.all( 31 | search.results.slice(0, postsPerPage).map((r) => r.data()) 32 | ); 33 | this.results = results; 34 | this.isSearching = false; 35 | } 36 | }; 37 | }; 38 | -------------------------------------------------------------------------------- /src/_assets/images/swup-logo-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | swup-logo-icon 11 | 12 | 13 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to GH pages 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | repository_dispatch: 7 | types: [ "redeploy_docs" ] 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | pages: write 13 | id-token: write 14 | 15 | concurrency: 16 | group: "pages" 17 | cancel-in-progress: false 18 | 19 | jobs: 20 | build: 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v3 26 | id: pages 27 | - name: Configure GH pages 28 | uses: actions/configure-pages@v3 29 | - name: install 30 | run: npm ci 31 | - name: build 32 | run: npm run build 33 | - name: Upload artifact 34 | uses: actions/upload-pages-artifact@v3 35 | 36 | deploy: 37 | environment: 38 | name: github-pages 39 | url: ${{ steps.deployment.outputs.page_url }} 40 | runs-on: ubuntu-latest 41 | needs: build 42 | steps: 43 | - name: Deploy to GitHub Pages 44 | id: deployment 45 | uses: actions/deploy-pages@v4 46 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/infoblocks.scss: -------------------------------------------------------------------------------- 1 | .infoblock { 2 | --info-color: var(--swup-green); 3 | --link-underline-color: var(--info-color); 4 | overflow: hidden; 5 | position: relative; 6 | padding: var(--gap); 7 | @include bp(l) { 8 | padding: var(--gap-small); 9 | } 10 | border-radius: var(--radius-1); 11 | } 12 | .infoblock.is--warning, 13 | .infoblock.is--caution { 14 | --info-color: var(--swup-red); 15 | } 16 | .infoblock::before { 17 | content: ''; 18 | display: block; 19 | position: absolute; 20 | inset-block: 0; 21 | left: 0; 22 | border-left: 3px solid var(--info-color); 23 | } 24 | .infoblock::after { 25 | content: ''; 26 | pointer-events: none; 27 | position: absolute; 28 | display: block; 29 | inset: 0; 30 | background-color: var(--info-color); 31 | z-index: 0; 32 | opacity: 0.2; 33 | @at-root .dark & { 34 | opacity: 0.3; 35 | } 36 | } 37 | .infoblock_header { 38 | display: flex; 39 | gap: 0.3em; 40 | padding-bottom: 0.5em; 41 | } 42 | .infoblock_header strong { 43 | font-weight: inherit; 44 | } 45 | .infoblock_body > * { 46 | margin: 0; 47 | } 48 | .infoblock_body > * + * { 49 | margin-top: var(--gap-small); 50 | } 51 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/features.scss: -------------------------------------------------------------------------------- 1 | .features { 2 | --min-column-width: 200px; 3 | --icon-size: 2.5rem; 4 | --border-style: 1px solid var(--color-transparent-1); 5 | margin-block: var(--gap) !important; 6 | list-style: none; 7 | padding: 0; 8 | gap: var(--gap-small); 9 | border: var(--border-style); 10 | border-radius: var(--radius-1); 11 | } 12 | .feature { 13 | position: relative; 14 | margin: 0; 15 | position: relative; 16 | display: flex; 17 | flex-direction: column; 18 | text-align: center; 19 | gap: var(--gap-small); 20 | align-items: center; 21 | padding: 1em; 22 | @include bp(xs) { 23 | padding: 0.3rem; 24 | flex-direction: row; 25 | text-align: start; 26 | gap: 0; 27 | } 28 | } 29 | .feature + .feature { 30 | border-top: var(--border-style); 31 | } 32 | .feature_icon { 33 | display: flex; 34 | align-items: center; 35 | justify-content: center; 36 | font-size: calc(var(--icon-size) * 0.45); 37 | background: var(--background); 38 | border: var(--border-style); 39 | width: var(--icon-size); 40 | height: var(--icon-size); 41 | flex: none; 42 | border-radius: var(--radius-round); 43 | @include bp(xs) { 44 | border: none; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swup Docs 2 | 3 | :blue_book: Documentation Website for [swup](https://swup.js.org/) 4 | 5 | ## Contributing 6 | 7 | Something to add? Found a typo? Help your future self and others by updating the docs. Simply edit the appropriate markdown files, the docs will be re-generated automatically ✨ 8 | 9 | ## Install locally 10 | 11 | ```sh 12 | git clone git@github.com:swup/docs.git 13 | cd ./docs 14 | npm install 15 | ``` 16 | 17 | ## Develop & Preview 18 | 19 | This site makes use of [Eleventy](https://github.com/11ty/eleventy) for compiling the markdown files to HTML. [WebPack](https://github.com/webpack/webpack) takes care of bundling and transpiling the assets (SCSS, JavaScript). 20 | 21 | ```sh 22 | npm run watch 23 | ``` 24 | 25 | This will start watch modes for both Eleventy and WebPack. 26 | Your terminal will print the exact `localhost` URL where you can preview your work. 27 | 28 | ## Build 29 | 30 | ```sh 31 | npm run build 32 | ``` 33 | 34 | ## Deploys 35 | 36 | - https://swup.js.org is hosted on GitHub pages via the [deploy workflow](./.github/workflows/deploy.yml) 37 | - https://v3.swup.js.org as well as deploy previews for PRs against the default branch are managed via the Netlify account of @hirasso 38 | -------------------------------------------------------------------------------- /src/docs/api/properties.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Properties 4 | eleventyNavigation: 5 | key: Properties 6 | parent: API 7 | order: 2 8 | description: Properties available on the swup instance 9 | permalink: /api/properties/ 10 | --- 11 | 12 | # Properties 13 | 14 | A few properties available on the swup instance that could be helpful. 15 | 16 | ## options 17 | 18 | Current [options](/options/), after merging swup defaults and user options. 19 | 20 | ## plugins 21 | 22 | Array of all [plugin](/plugins/) instances currently enabled on swup. 23 | 24 | ## location 25 | 26 | The location of the page last navigated to, after any redirects. This object inherits all properties 27 | from a native [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) object, with an additional 28 | `url` property that combines path and query param. 29 | 30 | ```js 31 | swup.location.href // https://example.net/path?query#hash 32 | swup.location.url // /path?query 33 | swup.location.pathname // /path 34 | swup.location.search // ?query 35 | swup.location.hash // #hash 36 | ``` 37 | 38 | ## currentPageUrl 39 | 40 | The URL of the page last navigated to, after any redirects. 41 | 42 | > [!NOTE] This property is deprecated, use `swup.location.url` instead. 43 | -------------------------------------------------------------------------------- /src/_assets/components/init-alpine.js: -------------------------------------------------------------------------------- 1 | import Alpine from 'alpinejs'; 2 | import persist from '@alpinejs/persist'; 3 | import focus from '@alpinejs/focus'; 4 | Alpine.plugin(persist); 5 | Alpine.plugin(focus); 6 | 7 | import Intro from './alpine/Intro/Intro.js'; 8 | import Search from './alpine/Search/Search.js'; 9 | import Page from './alpine/Page/Page.js'; 10 | import ColorSchemeSwitcher from './alpine/ColorSchemeSwitcher/ColorSchemeSwitcher.js'; 11 | import SwupThemeSwitcher from './alpine/SwupThemeSwitcher/SwupThemeSwitcher.js'; 12 | import MobileNav from './alpine/MobileNav/MobileNav.js'; 13 | import SearchUI from './alpine/SearchUI/SearchUI.js'; 14 | import TableOfContents from './alpine/TableOfContents/TableOfContents.js'; 15 | import VersionSelect from './alpine/VersionSelect/VersionSelect.js'; 16 | 17 | export default function () { 18 | window.Alpine = Alpine; 19 | Alpine.data('Intro', Intro); 20 | Alpine.data('Search', Search); 21 | Alpine.data('SearchUI', SearchUI); 22 | Alpine.data('Page', Page); 23 | Alpine.data('ColorSchemeSwitcher', ColorSchemeSwitcher); 24 | Alpine.data('SwupThemeSwitcher', SwupThemeSwitcher); 25 | Alpine.data('MobileNav', MobileNav); 26 | Alpine.data('TableOfContents', TableOfContents); 27 | Alpine.data('VersionSelect', VersionSelect); 28 | Alpine.start(); 29 | } 30 | -------------------------------------------------------------------------------- /src/docs/integrations/alpine.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Integrating Alpine.js 4 | eleventyNavigation: 5 | key: Alpine.js 6 | parent: Integrations 7 | order: 2 8 | description: How to integrate Alpine and swup 9 | permalink: /integrations/alpine/ 10 | --- 11 | 12 | # Integrating Alpine.js 13 | 14 | Swup works well with [Alpine.js](https://alpinejs.dev/) for managing component 15 | state and automating page lifecycles. Just initialize both libraries and enjoy 16 | automatic initialization of your components: 17 | 18 | ```javascript 19 | import Swup from 'swup'; 20 | import Alpine from 'alpinejs'; 21 | 22 | const swup = new Swup(); 23 | Alpine.start(); 24 | ``` 25 | 26 | ```html 27 |
28 |
29 | My Component 30 |
31 |
32 | ``` 33 | 34 | ## Handling swup hooks 35 | 36 | To register handlers for swup's hooks inside your Alpine components, you need to 37 | prepend `swup` to all hook names. You can access swup's visit object using the 38 | `detail` property on Alpine's `$event` magic. For example, hooking into `page:view` 39 | would look like this: 40 | 41 | ```html 42 |
43 | My Alpine Component 44 |
45 | ``` 46 | -------------------------------------------------------------------------------- /src/_includes/showcase-grid.njk: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | {{ content | prepareContent | safe }} 6 |
7 | 8 |
9 | {%- for site in collections.showcase | reverse -%} 10 | 31 | {%- endfor -%} 32 |
33 | 34 |
35 |
36 | -------------------------------------------------------------------------------- /src/_includes/page.njk: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | {{ content | prepareContent | safe }} 6 |
7 | 8 | {% if (eleventyNavigation) and (eleventyNavigation.key) %} 9 | {% set children = collections.all | eleventyNavigation(eleventyNavigation.key) %} 10 | {% if children | length %} 11 |
12 |

In this Section

13 | {{ children | eleventyNavigationToHtml() | safe }} 14 |
15 | {% endif %} 16 | {% endif %} 17 |
18 | 33 |
34 | {% if content | prepareContent | toc %} 35 | 41 | {% endif %} 42 | -------------------------------------------------------------------------------- /src/docs/other/browser-support.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Browser Support 4 | eleventyNavigation: 5 | key: Browser support 6 | parent: Other 7 | order: 2 8 | description: 9 | permalink: /other/browser-support/ 10 | --- 11 | 12 | # Browser Support 13 | 14 | ## Full support 15 | 16 | The following browsers are supported when swup is [loaded from a CDN](/getting-started/installation/#cdn). 17 | 18 | | Chrome | Edge | Safari | Safari iOS | Firefox | 19 | | - | - | - | - | - | 20 | | 80 | 80 | 13.1 | 13.4 | 74 | 21 | 22 | ## Improved support when transpiling 23 | 24 | Transpiling your code with tools like [Babel](https://babeljs.io/) will increase browser support. 25 | 26 | | Chrome | Edge | Safari | Safari iOS | Firefox | 27 | | - | - | - | - | - | 28 | | 66 | 16 | 13.0 | 13.0 | 60 | 29 | 30 | ## Improved support with polyfills 31 | 32 | Including polyfills for modern browser APIs using a service like [polyfill.io](https://polyfill.io/) 33 | will significantly increase browser support. Since it's a moving target that depends on the browsers 34 | of your visitors, you're encouraged to do some research of your own here. 35 | 36 | ## Improved support with previous versions 37 | 38 | If you absolutely need to support older browsers like IE 11, downgrading to 39 | [swup v3](https://v3.swup.js.org/other/browser-support/) will get you much closer to that goal, at 40 | the sacrifice of some of the newer features introduced in v4. 41 | 42 | ## Plugins 43 | 44 | This support matrix is valid for swup itself — plugins may differ in the list of supported browsers. 45 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/Page/Page.js: -------------------------------------------------------------------------------- 1 | import tippy from 'tippy.js'; 2 | import { isTouch } from '~/utils'; 3 | 4 | export default () => { 5 | return { 6 | init() { 7 | this.initHeadlineLinks(); 8 | this.initCodeBlocks(); 9 | }, 10 | initCodeBlocks() { 11 | this.$root.querySelectorAll('.code-block').forEach((block) => { 12 | const copyButton = block.querySelector('.code-block_copy'); 13 | const copyText = block.querySelector('.shiki > code').textContent; 14 | 15 | if (!isTouch()) { 16 | tippy(copyButton, { 17 | animation: 'none', 18 | placement: 'bottom', 19 | content: 'Copy' 20 | }); 21 | } 22 | 23 | const copiedTip = tippy(copyButton, { 24 | animation: 'none', 25 | placement: 'bottom', 26 | trigger: 'click', 27 | content: 'Copied!', 28 | onShow() { 29 | setTimeout(copiedTip.hide, 2000); 30 | } 31 | }); 32 | 33 | copyButton.addEventListener('click', (e) => 34 | navigator.clipboard.writeText(copyText) 35 | ); 36 | }); 37 | }, 38 | initHeadlineLinks() { 39 | document.querySelectorAll('.page_body .header-anchor').forEach((anchor) => { 40 | const target = anchor.querySelector('span'); 41 | 42 | const copiedTip = tippy(target, { 43 | placement: 'bottom', 44 | trigger: 'click', 45 | content: 'URL copied!', 46 | offset: [0, 10], 47 | triggerTarget: anchor, 48 | arrow: true, 49 | onShow() { 50 | setTimeout(copiedTip.hide, 2000); 51 | } 52 | }); 53 | anchor.addEventListener('click', function (event) { 54 | navigator.clipboard.writeText(anchor.href); 55 | }); 56 | }); 57 | } 58 | }; 59 | }; 60 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/demos.scss: -------------------------------------------------------------------------------- 1 | .swupdemo { 2 | --swupdemo-scale: 0.8; 3 | position: relative; 4 | } 5 | 6 | .swupdemo__frame { 7 | position: relative; 8 | width: 100%; 9 | min-width: 300px; 10 | height: calc((500px + 6vh) * var(--swupdemo-scale)); 11 | position: relative; 12 | resize: both; 13 | border: 1px solid var(--color-transparent-1); 14 | border-radius: var(--radius-1); 15 | overflow: hidden; 16 | filter: drop-shadow(0 0 5px hsl(var(--shadow-color) / var(--shadow-strength-dark))); 17 | iframe { 18 | position: absolute; 19 | top: 0; 20 | left: 0; 21 | width: 100%; 22 | height: 100%; 23 | width: calc(100% / var(--swupdemo-scale)); 24 | height: calc(100% / var(--swupdemo-scale)); 25 | background: transparent; 26 | transform: scale(var(--swupdemo-scale)); 27 | transform-origin: 0 0; 28 | } 29 | } 30 | 31 | @include bp(s) { 32 | .swupdemo { 33 | --swupdemo-scale: 0.667; 34 | } 35 | .swupdemo__frame { 36 | width: 80%; 37 | } 38 | } 39 | 40 | .swupdemo__link { 41 | position: absolute; 42 | bottom: 0.4rem; 43 | right: 0.4rem; 44 | @include bp(s) { 45 | bottom: 0.6rem; 46 | right: 0.6rem; 47 | } 48 | margin: 0; 49 | } 50 | 51 | .swupdemo__pill { 52 | display: inline-block; 53 | line-height: 1; 54 | white-space: nowrap; 55 | padding: 0.5em 0.8em; 56 | background: black; 57 | color: white; 58 | font-size: 0.7rem; 59 | border-radius: 0.5em; 60 | border: 1px solid rgb(255 255 255 / 0.2); 61 | --shadow-color: 239 80% 90%; 62 | box-shadow: var(--shadow-4); 63 | vertical-align: middle; 64 | } 65 | .swupdemo__pill--dummy { 66 | position: relative; 67 | top: -0.1em; 68 | margin-inline: 0.2rem; 69 | pointer-events: none; 70 | } 71 | -------------------------------------------------------------------------------- /lib/packages/markdown-it-shiki-extra/worker.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __defProp = Object.defineProperty; 3 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 | var __getOwnPropNames = Object.getOwnPropertyNames; 5 | var __hasOwnProp = Object.prototype.hasOwnProperty; 6 | var __copyProps = (to, from, except, desc) => { 7 | if (from && typeof from === "object" || typeof from === "function") { 8 | for (let key of __getOwnPropNames(from)) 9 | if (!__hasOwnProp.call(to, key) && key !== except) 10 | __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 11 | } 12 | return to; 13 | }; 14 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 15 | 16 | // src/worker.ts 17 | var worker_exports = {}; 18 | module.exports = __toCommonJS(worker_exports); 19 | var import_shiki = require("shiki"); 20 | var import_synckit = require("synckit"); 21 | var highlighter; 22 | async function handler(command, options) { 23 | if (command === "getHighlighter") { 24 | highlighter = await (0, import_shiki.getHighlighter)(options); 25 | } else { 26 | let { code, lang, lineOptions, theme } = options; 27 | const loadedLangs = highlighter.getLoadedLanguages(); 28 | // if (!loadedLangs.includes(lang)) 29 | // await highlighter.loadLanguage(lang); 30 | // const loadedThemes = highlighter.getLoadedThemes(); 31 | // if (!loadedThemes.includes(theme)) 32 | // await highlighter.loadTheme(theme); 33 | if (!loadedLangs.includes(lang)) 34 | lang = "text"; 35 | return highlighter.codeToHtml(code, { 36 | lang, 37 | lineOptions: lineOptions ?? [], 38 | theme 39 | }); 40 | } 41 | } 42 | (0, import_synckit.runAsWorker)(handler); 43 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/header.scss: -------------------------------------------------------------------------------- 1 | .header { 2 | width: 100%; 3 | display: flex; 4 | padding-inline: var(--gap) calc(var(--gap) * 0.5); 5 | @include bp(m) { 6 | padding-inline: var(--gap); 7 | } 8 | height: var(--header-height); 9 | 10 | gap: 1rem; 11 | align-items: center; 12 | position: sticky; 13 | top: 0; 14 | transition: opacity 300ms; 15 | transition-delay: 400ms; 16 | z-index: 4; 17 | pointer-events: none; 18 | 19 | @include bp(1600, max) { 20 | background: var(--background); 21 | border-bottom: 1px solid var(--color-transparent-1); 22 | } 23 | 24 | @at-root body.front-page & { 25 | opacity: 0; 26 | pointer-events: none; 27 | transition-delay: 0ms; 28 | position: absolute; 29 | * { 30 | pointer-events: none !important; 31 | } 32 | } 33 | } 34 | .header a, 35 | .header button { 36 | pointer-events: all; 37 | } 38 | 39 | /* 40 | * Site Title 41 | */ 42 | .site-title { 43 | display: flex; 44 | align-items: center; 45 | margin-inline-end: auto; 46 | font-size: 1.1em; 47 | } 48 | .site-title_image { 49 | display: block; 50 | --size: clamp(1.8rem, 3vw, 2.2rem); 51 | width: var(--size); 52 | height: var(--size); 53 | position: relative; 54 | top: 0.1em; 55 | margin-inline-end: 0.7em; 56 | } 57 | .site-title_swup { 58 | font-weight: bold; 59 | display: none; 60 | @include bp(300) { 61 | display: block; 62 | } 63 | } 64 | .site-title_breadcrumb { 65 | display: flex; 66 | align-items: center; 67 | color: var(--color-transparent-3); 68 | position: relative; 69 | transition: opacity 0.3s, transform 0.4s; 70 | @at-root .is-animating & { 71 | opacity: 0; 72 | } 73 | svg { 74 | display: inline-block; 75 | margin: 0 0.15em 0 0.2em; 76 | width: 0.9em; 77 | height: 0.9em; 78 | position: relative; 79 | top: 0.05em; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/_includes/header.njk: -------------------------------------------------------------------------------- 1 |
2 | 3 | {{ site.title }} 4 | {{ site.title }} 5 | {% feather "chevron-right" %} {{ title }} 6 | 7 | 8 |
9 | 10 |
11 | {% include "mobile-nav.njk" %} 12 |
13 | 14 | 15 | {% include "search.njk" %} 16 | 17 | {% include "version-select.njk" %} 18 | {% include "color-scheme-switcher.njk" %} 19 | 20 | 21 | {#
22 | {% include "swup-theme-switcher.njk" %} 23 |
#} 24 | 25 | 26 | GitHub 27 | swup on GitHub 28 | 29 |
30 | 31 |
32 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/tables.scss: -------------------------------------------------------------------------------- 1 | table { 2 | display: block; 3 | width: 100%; 4 | max-width: 100%; 5 | margin-block: var(--gap); 6 | overflow-x: auto; 7 | border-collapse: separate; 8 | border-spacing: 0; 9 | border: 1px solid var(--color-transparent-1); 10 | border-radius: var(--radius-1); 11 | font-size: 0.8rem; 12 | 13 | @include bp(s) { 14 | display: table; 15 | font-size: 1rem; 16 | } 17 | } 18 | 19 | th, 20 | td { 21 | min-width: 120px; 22 | padding-block: 1em; 23 | padding-inline: 1em; 24 | background-color: transparent; 25 | border-bottom: 1px solid var(--color-transparent-1); 26 | vertical-align: top; 27 | 28 | &:not(:first-of-type) { 29 | border-left: 1px solid var(--color-transparent-1); 30 | } 31 | } 32 | tr:last-child td { 33 | border-bottom: 0; 34 | } 35 | tr[data-swup-scroll-target] { 36 | background: var(--color-transparent-0); 37 | } 38 | tr:first-child th:first-child, 39 | tr:first-child td:first-child { 40 | border-top-left-radius: var(--radius-1); 41 | } 42 | tr:first-child th:last-child, 43 | tr:first-child td:last-child { 44 | border-top-right-radius: var(--radius-1); 45 | } 46 | tr:last-child td:first-child { 47 | border-bottom-left-radius: var(--radius-1); 48 | } 49 | tr:last-child td:last-child { 50 | border-bottom-right-radius: var(--radius-1); 51 | } 52 | 53 | thead { 54 | th { 55 | text-align: left; 56 | border-bottom: 1px solid var(--color-transparent-1); 57 | } 58 | } 59 | 60 | @include bp(s, max) { 61 | .events-table table { 62 | font-size: 1rem; 63 | border-radius: var(--radius-0); 64 | 65 | thead { 66 | display: none; 67 | } 68 | 69 | tr, 70 | th, 71 | td { 72 | display: block; 73 | } 74 | 75 | tr { 76 | border-bottom: 1px solid var(--color-transparent-1); 77 | padding: 0.75em 1em; 78 | } 79 | 80 | td { 81 | border: none; 82 | padding: 0; 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/docs/getting-started/videos.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Tutorials 4 | eleventyNavigation: 5 | key: Tutorials 6 | parent: Getting Started 7 | order: 6 8 | description: A few video tutorials by people around the web 9 | permalink: /getting-started/videos/ 10 | --- 11 | 12 | # Tutorials 13 | 14 | If you prefer visual learning, you can find a wealth of video tutorials created by swup users. They 15 | provide step-by-step guidance and in-depth explanations of advanced features. If you're looking for 16 | more examples, we also recommend looking for more 17 | [swup content on YouTube](https://www.youtube.com/results?search_query=swup). 18 | 19 | ## Build Amazing Page Transitions In Only 12 Minutes 20 | 21 | > All it takes is a single library called Swup and a few CSS styles and your entire web application will have smooth animations. 22 | 23 | @[youtube](http://youtu.be/eVwH3VL1EsA) 24 | 25 | © Web Dev Simplified 26 | 27 | ## Creating Page Transition Animations Easily 28 | 29 | > Swup gives you the ability to easily integrate page transition animations and provides you with a lot of control and flexibility by defining the animations yourself in CSS. 30 | 31 | @[youtube](http://youtu.be/mWeYMyN5-oo) 32 | 33 | © DesignCourse 34 | 35 | ## Page Transitions: How to Create Them? With Swup! 36 | 37 | > Content in Spanish 38 | 39 | @[youtube](http://youtu.be/mJIQ9621VUs) 40 | 41 | © AnimatiCSS 42 | 43 | ## Transitions Between Pages With Swup 44 | 45 | > Content in French 46 | 47 | @[youtube](http://youtu.be/sNCgfwQJdTM) 48 | 49 | © Grafikart.fr 50 | 51 | ## Creating Page Transitions With Swup 52 | 53 | > Content in Italian 54 | 55 | @[youtube](http://youtu.be/AuBgXR1OC94) 56 | 57 | © Marchetti Design 58 | 59 | ## Swup Transition in Astro 60 | 61 | > Content in German 62 | 63 | @[youtube](http://youtu.be/uWitjqeGfh8) 64 | 65 | © Programmieren mit Mario 66 | -------------------------------------------------------------------------------- /lib/helpers.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | const { execSync } = require('child_process'); 4 | const { mkdtempSync, rmSync } = require('fs'); 5 | const { tmpdir } = require('os'); 6 | const { join } = require('path'); 7 | 8 | /** 9 | * Log and exit 10 | */ 11 | function dd(...args) { 12 | console.log(...args); 13 | process.exit(); 14 | } 15 | 16 | /** 17 | * A cache for default branches 18 | * @type {Map} 19 | */ 20 | const defaultBranches = new Map(); 21 | 22 | /** 23 | * Detect the default branch of a GitHub repo by cloning it 24 | * 25 | * @param {string} repoURL - HTTPS clone URL of the repo (e.g. https://github.com/user/repo.git) 26 | * @return {Promise} - Default branch name 27 | */ 28 | function getDefaultBranch(repoURL) { 29 | repoURL = repoURL.replace(/\/$/, '') + '.git'; 30 | 31 | return new Promise((resolve) => { 32 | const cached = defaultBranches.get(repoURL); 33 | if (!!cached) { 34 | resolve(cached); 35 | return; 36 | } 37 | 38 | const tmpDir = mkdtempSync(join(tmpdir(), 'repo-')); 39 | 40 | try { 41 | // Bare, shallow clone for speed 42 | execSync(`git clone --bare --depth=1 ${repoURL} .`, { 43 | cwd: tmpDir, 44 | stdio: 'ignore' 45 | }); 46 | 47 | const output = execSync(`git remote show origin`, { 48 | cwd: tmpDir 49 | }).toString(); 50 | 51 | const match = output.match(/HEAD branch: (.+)/); 52 | if (match) { 53 | defaultBranches.set(repoURL, match[1].trim()); 54 | resolve(match[1].trim()); 55 | return; 56 | } 57 | } catch (error) { 58 | console.error(`Error detecting default branch for ${repoURL}: ${error.message}`); 59 | } finally { 60 | rmSync(tmpDir, { recursive: true, force: true }); 61 | } 62 | defaultBranches.set(repoURL, 'master'); 63 | resolve('master'); 64 | }); 65 | } 66 | 67 | 68 | module.exports = { 69 | dd, 70 | getDefaultBranch, 71 | }; 72 | -------------------------------------------------------------------------------- /src/showcase/README.md: -------------------------------------------------------------------------------- 1 | # Add Your Site to the Swup Showcase 2 | 3 | Have you created a site you want to share with the swup community? Great! Adding it to the Showcase 4 | will highlight your project and encourage others with its design and implementation. 5 | 6 | ## A Few Guidelines 7 | 8 | - **Quality Matters**: We're looking to showcase professional, visually appealing, and accessible websites. Ensure your site meets these criteria before submitting. 9 | - **Give Credit**: Make sure to attribute the agency and/or freelancer who designed and built the site. 10 | 11 | ## How to Add Your Site 12 | 13 | Adding your site to the Swup Showcase is straightforward. 14 | 15 | 1. **Fork the Docs Repository**: 16 | - Begin by creating a fork of our [docs repository](https://github.com/swup/docs). 17 | - This will copy the repository to your account, allowing you to make changes. 18 | 19 | 2. **Prepare Your Showcase File**: 20 | - Navigate to the [`showcase/`](https://github.com/swup/docs/tree/main/src/showcase) directory. 21 | - Make a copy of the [`_showcase.md`](https://github.com/swup/docs/tree/main/src/showcase/_showcase.md) example file. 22 | - Rename your copy to something descriptive of your site (e.g., `your-site-name.md`). 23 | - Edit the file to include information about your website, following the template. 24 | 25 | 3. **Add a Screenshot**: 26 | - Take a PNG screenshot of your website in a 4:3 landscape ratio of at least 1200px width. 27 | - Name the screenshot file to match your `.md` file (e.g., `your-site-name.png`). 28 | - Add this image to the same `showcase/` directory. 29 | 30 | 4. **Create a Pull Request**: 31 | - Once you've added the new files, create a pull request against the docs repository. 32 | - Provide a short description of the addition in the PR and add a link to the site. 33 | - Submit your PR and wait for a maintainer to review it. 34 | 35 | ## That's It 36 | 37 | We're excited to see your websites and share them with the swup community! 38 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/showcase.scss: -------------------------------------------------------------------------------- 1 | .showcase_grid { 2 | margin-block: var(--gap); 3 | display: grid; 4 | grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 5 | gap: var(--gap); 6 | border: var(--border-style); 7 | border-radius: var(--radius-1); 8 | } 9 | 10 | .showcase_item { 11 | position: relative; 12 | display: flex; 13 | flex-direction: column; 14 | border: 1px solid var(--color-transparent-1); 15 | border-radius: var(--radius-1); 16 | overflow: hidden; 17 | padding-bottom: 0.8rem; 18 | a { 19 | position: relative; 20 | z-index: 2; 21 | } 22 | > a { 23 | position: absolute; 24 | top: 0; 25 | left: 0; 26 | width: 100%; 27 | height: 100%; 28 | opacity: 0; 29 | user-select: none; 30 | z-index: 1; 31 | } 32 | } 33 | 34 | header.showcase_header { 35 | display: flex; 36 | justify-content: space-between; 37 | align-items: baseline; 38 | padding: 0.8rem 1rem 0; 39 | border-top: 1px solid var(--color-transparent-1); 40 | svg { 41 | position: relative; 42 | top: 0.2em !important; 43 | color: var(--color-transparent-2); 44 | } 45 | } 46 | 47 | h2.showcase_title { 48 | padding-right: 1.5em; 49 | font-size: inherit; 50 | font-weight: bold; 51 | margin: 0; 52 | a { 53 | font-weight: bold; 54 | } 55 | } 56 | 57 | ul.showcase_credits { 58 | list-style: none; 59 | padding: 0; 60 | margin: 0; 61 | margin-top: 0.25em; 62 | padding: 0 1rem; 63 | display: flex; 64 | flex-wrap: wrap; 65 | font-size: var(--font-size-fluid-0-B); 66 | > :not(:last-child)::after { 67 | content: '•'; 68 | margin-inline: 0.5em; 69 | color: var(--color-transparent-3); 70 | } 71 | a { 72 | color: var(--color-transparent-3); 73 | } 74 | } 75 | 76 | figure.showcase_image { 77 | position: relative; 78 | order: -1; 79 | width: 100%; 80 | height: 0; 81 | margin: 0; 82 | overflow: hidden; 83 | padding-bottom: 75%; 84 | img { 85 | position: absolute; 86 | top: 0; 87 | left: 0; 88 | width: 100%; 89 | height: 100%; 90 | object-fit: cover; 91 | object-position: top left; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/docs/getting-started/how-it-works.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: How It Works 4 | eleventyNavigation: 5 | key: How it works 6 | parent: Getting Started 7 | order: 1 8 | description: A simple explanation of how swup gets things done 9 | permalink: /getting-started/how-it-works/ 10 | --- 11 | 12 | # How It Works 13 | 14 | Instead of letting the browser load the next page, swup intercepts link clicks, loads the new 15 | page in the background and smoothly animates between the old and new content. 16 | 17 | Read on to learn about key concepts of swup. 18 | 19 | ## Containers 20 | 21 | Swup will not replace the whole body on each page load. Instead, it will only replace the actual 22 | [content containers](/options/#containers) on your page. By default, swup will only replace a 23 | container with the id `#swup` but you can configure additional containers like headers or navigation 24 | menus. 25 | 26 | ## Automatic animation timing {#timing} 27 | 28 | Swup is built around animations and will wait for CSS animations, JS animations, and native 29 | View Transitions before updating the page with the new content. See 30 | [Defining animations](/getting-started/animations/) for details and examples. 31 | 32 | ## Browser history {#history} 33 | 34 | Swup will update and push to the browser history API. The current URL in the browser always reflects 35 | the actual URL of the last requested page. Forward/backward visits will continue to work 36 | as expected. On history visits, the scroll position will be restored as well. 37 | 38 | ## Scroll behavior {#scrolling} 39 | 40 | Swup emulates native browser behavior for scrolling. Between page visits, the scroll position will 41 | be reset to the top. Clicking on an anchor link to the same page will jump to that anchor. 42 | 43 | ## Hooks 44 | 45 | To trigger custom logic or modify swup's behavior, you can register [hook handlers](/hooks/). 46 | 47 | ## Plugins 48 | 49 | Swup was designed to be small but modular. Any extended functionality can be added via one of the 50 | many official or third-party [plugins](/plugins/). 51 | -------------------------------------------------------------------------------- /src/docs/other/contributions.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Contributions 4 | eleventyNavigation: 5 | key: Contributions 6 | parent: Other 7 | order: 3 8 | description: How to contribute to swup's development 9 | permalink: /other/contributions/ 10 | --- 11 | 12 | # Contributions 13 | 14 | Any contributions are more than welcome. 15 | 16 | If you have a question, suggestion, or feature request, feel free to 17 | 18 | - [start a discussion](https://github.com/swup/swup/discussions/new) 19 | - [open an issue](https://github.com/swup/swup/issues/new) 20 | - [create a pull request](https://github.com/swup/swup/pulls) 21 | 22 | ## Pull Requests 23 | 24 | If you would like to see a new feature in swup, we encourage you to fork swup and create a [pull request](https://github.com/swup/swup/pulls)! 25 | 26 | Please make sure to run the swup tests locally before creating your PR on GitHub: 27 | 28 | ```shell 29 | npm install && npm run test 30 | ``` 31 | 32 | ## Plugins & Themes 33 | 34 | Creating [plugins](/plugins/create-plugin/) and [themes](/themes/create-theme/) is encouraged. 35 | You can list your plugin or plugin idea in the [Plugin Ideas](https://github.com/swup/swup/discussions/335) discussion thread. 36 | 37 | ## Join Us 38 | 39 | If you think you're proficient in the swup ecosystem and you'd like to join the team, please get in touch at gmarcuk@gmail.com. 40 | 41 | ## Support Us 42 | 43 | If you'd like to support swup financially, please do so on our [Open Collective](https://opencollective.com/swup) page or through [GitHub sponsors](https://github.com/sponsors/gmrchk). Any contribution is much appreciated. 44 | 45 | 49 | 50 | ## Acknowledgements 51 | 52 | Swup logo created by [Honza Jura](https://twitter.com/honzajura). 53 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/Intro/Intro.js: -------------------------------------------------------------------------------- 1 | import { gsap } from 'gsap'; 2 | 3 | export default () => { 4 | const tl = gsap.timeline({ delay: 0.5 }); 5 | 6 | const popIn = { 7 | y: 50, 8 | duration: 0.4, 9 | autoAlpha: 0, 10 | ease: 'back.out', 11 | clearProps: 'all', 12 | transition: 'none' 13 | }; 14 | 15 | const fadeIn = { 16 | autoAlpha: 0, 17 | y: 20, 18 | ease: 'quart.easeOut', 19 | duration: 0.4, 20 | clearProps: 'all' 21 | }; 22 | 23 | const slideUp = { 24 | y: 50, 25 | scaleY: 3, 26 | ease: 'quint.out', 27 | duration: 0.7 28 | }; 29 | 30 | const letterDelay = '<0.1'; 31 | 32 | return { 33 | async init() { 34 | this.$root.style.visibility = 'hidden'; 35 | 36 | this.sliceLogo(); 37 | 38 | await this.$nextTick(); 39 | 40 | this.$root.style.visibility = 'visible'; 41 | 42 | this.createAnimation(); 43 | }, 44 | 45 | createAnimation() { 46 | tl.from(this.$refs.link, slideUp); 47 | 48 | tl.from(this.$refs.s, popIn, 0); 49 | tl.from(this.$refs.w, popIn, letterDelay); 50 | tl.from(this.$refs.u, popIn, letterDelay); 51 | tl.from(this.$refs.p, popIn, letterDelay); 52 | 53 | tl.from(this.$refs.dot1, { ...popIn, y: -20 }, '<0.3'); 54 | tl.from(this.$refs.dot2, { ...popIn, y: -20 }, letterDelay); 55 | 56 | tl.from(this.$refs.slogan, fadeIn, '<0.3'); 57 | 58 | tl.from(this.$refs.button1, fadeIn, letterDelay); 59 | tl.from(this.$refs.button2, fadeIn, letterDelay); 60 | 61 | tl.from(this.$refs.announcement, { ...popIn, y: -20 }, '<0.5'); 62 | }, 63 | 64 | cancelAnimation() { 65 | tl.seek(5); 66 | }, 67 | 68 | sliceLogo() { 69 | const refs = ['s', 'w', 'u', 'p', 'dot1', 'dot2']; 70 | const paths = this.$refs.logo.querySelectorAll('path'); 71 | const parentNode = this.$refs.logo.parentNode; 72 | paths.forEach((path, index) => { 73 | const clone = this.$refs.logo.cloneNode(); 74 | clone.setAttribute('x-ref', refs[index]); 75 | clone.append(path.cloneNode()); 76 | parentNode.append(clone); 77 | }); 78 | this.$refs.logo.remove(); 79 | } 80 | }; 81 | }; 82 | -------------------------------------------------------------------------------- /src/docs/getting-started/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Installation 4 | eleventyNavigation: 5 | key: Installation 6 | parent: Getting Started 7 | order: 2 8 | description: Swup can be installed in few ways 9 | permalink: /getting-started/installation/ 10 | --- 11 | 12 | # Installation 13 | 14 | ## Bundler 15 | 16 | If you use a bundler in your project, install swup from npm: 17 | 18 | ```shell 19 | npm install swup 20 | ``` 21 | 22 | In your application, import swup and create a new instance: 23 | 24 | ```javascript 25 | import Swup from 'swup'; 26 | const swup = new Swup(); 27 | ``` 28 | 29 | ## CDN 30 | 31 | If you're not using a bundler and want to get started quickly, you can include the minified 32 | production file from a CDN and create a new instance in your main script: 33 | 34 | ```html 35 | 36 | 39 | ``` 40 | 41 | ## ESM 42 | 43 | Swup and its plugins can be imported as native ES modules for modern browsers. The specifics differ 44 | depending on the CDN, but here is a [pattern](https://web.dev/serve-modern-code-to-modern-browsers/) 45 | for including the ES module where supported, and falling back to a UMD version for older browsers. 46 | Note the `?module` query string in the first import URL. 47 | 48 | ```html 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 62 | ``` 63 | 64 | ## Next steps 65 | 66 | You're now ready to start building with swup by exploring these topics: 67 | 68 | - Create a first [example site](/getting-started/example/) to get to know swup 69 | - Look at [interactive demos](/getting-started/demos/) to see swup in action 70 | - Learn about [options](/options/) and [hooks](/hooks/) to customize how swup works 71 | - Install [plugins](/plugins/) and [themes](/themes/) for extended functionality 72 | -------------------------------------------------------------------------------- /src/_assets/components/alpine/TableOfContents/TableOfContents.js: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return { 3 | wrap: null, 4 | lastChild: null, 5 | horizon: 150, 6 | sections: [], 7 | async init() { 8 | await this.$nextTick(); 9 | this.wrap = document.querySelector('.page_body'); 10 | this.updateHorizon(); 11 | this.prepareSections(); 12 | this.markCurrentSection(); 13 | }, 14 | bindings: { 15 | 'x-on:resize.window': 'updateHorizon', 16 | 'x-on:scroll.window.throttle.10ms': 'markCurrentSection' 17 | }, 18 | updateHorizon() { 19 | this.horizon = this.$root.getBoundingClientRect().top + 50; 20 | }, 21 | // Store a reference to all sections in reversed order 22 | prepareSections() { 23 | this.sections = [...this.wrap.querySelectorAll('h2[id],h3[id],h4[id]')].reverse(); 24 | }, 25 | /** 26 | * Marks the current section with the class "is-active" 27 | * @returns void 28 | */ 29 | markCurrentSection() { 30 | const currentSection = this.getCurrentSection(); 31 | if (!currentSection) return; 32 | this.$root.querySelector('a.is-active')?.classList.remove('is-active'); 33 | this.$root.querySelector(`a[href="#${currentSection.id}"]`)?.classList.add('is-active'); 34 | }, 35 | /** 36 | * Tries to find the current section. The sections are reversed (from bottom to top), to 37 | * make the whole process more performant. 38 | * @returns HTMLElement 39 | */ 40 | getCurrentSection() { 41 | const firstSection = this.sections[this.sections.length - 1]; 42 | const lastSection = this.sections[0]; 43 | 44 | // If the bottom of the document is reached, mark the last section as the active one 45 | if (window.scrollY >= document.documentElement.offsetHeight - window.innerHeight - 5) { 46 | return lastSection; 47 | } 48 | // Find the first section that is above the horizon. 49 | // If no section can be found, return the first section 50 | return ( 51 | this.sections.find((section) => { 52 | const rect = section.getBoundingClientRect(); 53 | // ignore invisible sections 54 | if (!rect.height) return false; 55 | return rect.top < this.horizon; 56 | }) || firstSection 57 | ); 58 | } 59 | }; 60 | }; 61 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/base.scss: -------------------------------------------------------------------------------- 1 | html { 2 | font-size: 17px; 3 | line-height: 1.6; 4 | overflow-y: scroll; 5 | @supports (scrollbar-gutter: stable) { 6 | overflow-y: auto; 7 | scrollbar-gutter: stable; 8 | } 9 | } 10 | 11 | body { 12 | color: var(--color); 13 | background: var(--background); 14 | } 15 | 16 | a { 17 | color: inherit; 18 | font-weight: 400; 19 | text-decoration: none; 20 | } 21 | 22 | ::selection { 23 | background-color: var(--swup-red); 24 | color: white; 25 | } 26 | 27 | :focus-visible { 28 | outline-offset: 0; 29 | outline: 2px solid var(--swup-green); 30 | } 31 | 32 | ul { 33 | list-style: disc; 34 | } 35 | 36 | ul ::marker { 37 | color: var(--swup-green); 38 | } 39 | 40 | /* 41 | * Don't render an outline for a focused main element 42 | * @see https://swup.js.org/plugins/a11y-plugin/#styling 43 | */ 44 | main[tabindex='-1'] { 45 | outline: none; 46 | } 47 | 48 | /* 49 | * Hide alpine components initially 50 | */ 51 | .js [x-cloak] { 52 | visibility: hidden; 53 | opacity: 0; 54 | pointer-events: none; 55 | } 56 | 57 | /* 58 | * Container 59 | */ 60 | @include bp(m) { 61 | .default .container, 62 | .showcase .container { 63 | display: grid; 64 | grid-template-columns: 250px minmax(0, 1fr); 65 | } 66 | } 67 | @include bp(xl) { 68 | .default #swup, 69 | .showcase #swup { 70 | display: grid; 71 | grid-template-columns: minmax(0, 1fr) 250px; 72 | align-items: start; 73 | } 74 | } 75 | 76 | /* 77 | * External Links 78 | */ 79 | ul.nav_list a[href^='http'], 80 | .in-this-section ul a[href^='http'] { 81 | --_icon-size: 1.2em; 82 | &::after { 83 | content: ''; 84 | display: inline-block; 85 | width: var(--_icon-size); 86 | height: var(--_icon-size); 87 | vertical-align: middle; 88 | position: relative; 89 | top: -0.05em; 90 | background-image: var(--external-link-icon); 91 | background-repeat: no-repeat; 92 | background-size: contain; 93 | opacity: 0.5; 94 | } 95 | @include mixins.hover { 96 | &::after { 97 | opacity: 1; 98 | } 99 | } 100 | } 101 | ul.nav_list a[href^='http'] { 102 | --link-underline-color: transparent; 103 | } 104 | -------------------------------------------------------------------------------- /src/docs/api/methods.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Methods 4 | eleventyNavigation: 5 | key: Methods 6 | parent: API 7 | order: 3 8 | description: Methods on the swup instance 9 | permalink: /api/methods/ 10 | --- 11 | 12 | # Methods 13 | 14 | ## navigate 15 | 16 | Navigate and transition to a URL. Pass an options object to configure how the page is loaded. 17 | 18 | ```javascript 19 | swup.navigate(url); 20 | ``` 21 | 22 | Disable animations for this visit: 23 | 24 | ```javascript 25 | swup.navigate(url, { animate: false }); 26 | ``` 27 | 28 | Set a custom animation name: 29 | 30 | ```javascript 31 | swup.navigate(url, { animation: 'custom' }); 32 | ``` 33 | 34 | Replace the current history entry instead of creating a new one: 35 | 36 | ```javascript 37 | swup.navigate(url, { history: 'replace' }); 38 | ``` 39 | 40 | Send a POST request with form data: 41 | 42 | ```javascript 43 | swup.navigate(url, { method: 'POST', data: new FormData() }); 44 | ``` 45 | 46 | Disable the cache for this request: 47 | 48 | ```javascript 49 | swup.navigate(url, { cache: { read: false, write: true } }); 50 | ``` 51 | 52 | Send along [custom metadata](/visit/#pass-along-custom-metadata) available in all hooks: 53 | 54 | ```javascript 55 | swup.navigate(url, { meta: { lorem: 'ipsum' } }) 56 | ``` 57 | 58 | 59 | ## destroy 60 | 61 | Disables swup. 62 | 63 | ```javascript 64 | swup.destroy(); 65 | ``` 66 | 67 | ## use/unuse 68 | 69 | Enable and disable plugins. 70 | 71 | ```javascript 72 | // Enable plugin: accepts an instantiated instance 73 | swup.use(new SwupScrollPlugin()); 74 | 75 | // Disable plugin: accepts either name or instance 76 | swup.unuse('SwupScrollPlugin'); 77 | ``` 78 | 79 | ## findPlugin 80 | 81 | Returns the plugin instance by that name, if enabled. 82 | 83 | ```javascript 84 | const pluginInstance = swup.findPlugin('SwupScrollPlugin'); 85 | ``` 86 | 87 | ## log 88 | 89 | Does nothing by default, but outputs the passed content when the [debug plugin](/plugins/debug-plugin/) is used. 90 | Accepts two arguments, the content of message and an optional log object which gets printed in a console group. 91 | 92 | ```javascript 93 | swup.log('Something happened', { lorem: 'ipsum' }); 94 | ``` 95 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/breakpoints.scss: -------------------------------------------------------------------------------- 1 | $media-direction: min; // min / max — default is min (mobile first) 2 | 3 | $breakpoints: ( 4 | default: '', 5 | xs: 420px, 6 | s: 667px, 7 | m: 1024px, 8 | l: 1280px, 9 | xl: 1480px 10 | ); 11 | 12 | /* -------------------------------------------------- 13 | 14 | Breakpoint Mixin 15 | -------------------------------------------------- */ 16 | 17 | // $breakpoint = the size you need. 18 | // You can also simply enter a value instead of 'xs', 's', 'm', 'l', 'xl'. 19 | // This makes sense if you need a special breakpoint. You don't have to put it into the sass map. 20 | // $direction: $media-direction = what you have set in the settings. 21 | @mixin bp($breakpoint, $direction: $media-direction) { 22 | // If the value is present in the Sass map. 23 | @if map-has-key($breakpoints, $breakpoint) { 24 | // Result 25 | @media (#{$direction}-width: #{map-get($breakpoints, $breakpoint)}) { 26 | @content; 27 | } 28 | } 29 | 30 | // If you have entered a value above, it will be checked here if you have attached a unit. If not, px will be used. 31 | @else if unitless($breakpoint) { 32 | $breakpoint: $breakpoint + 0px; 33 | 34 | // Result 35 | @media (#{$direction}-width: $breakpoint) { 36 | @content; 37 | } 38 | } 39 | } 40 | 41 | /* 42 | * Hide elements based on viewport 43 | */ 44 | .xs\3ahidden { 45 | @include bp(xs) { 46 | display: none !important; 47 | } 48 | } 49 | .xs\3amax\3ahidden { 50 | @include bp(xs, max) { 51 | display: none !important; 52 | } 53 | } 54 | 55 | .s\3ahidden { 56 | @include bp(s) { 57 | display: none !important; 58 | } 59 | } 60 | .s\3amax\3ahidden { 61 | @include bp(s, max) { 62 | display: none !important; 63 | } 64 | } 65 | 66 | .m\3ahidden { 67 | @include bp(m) { 68 | display: none !important; 69 | } 70 | } 71 | .m\3amax\3ahidden { 72 | @include bp(m, max) { 73 | display: none !important; 74 | } 75 | } 76 | 77 | .l\3ahidden { 78 | @include bp(l) { 79 | display: none !important; 80 | } 81 | } 82 | .l\3amax\3ahidden { 83 | @include bp(l, max) { 84 | display: none !important; 85 | } 86 | } 87 | 88 | .xl\3ahidden { 89 | @include bp(xl) { 90 | display: none !important; 91 | } 92 | } 93 | .xl\3amax\3ahidden { 94 | @include bp(xl, max) { 95 | display: none !important; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/_assets/images/swup-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 13 | 18 | 21 | 24 | 26 | 28 | 29 | -------------------------------------------------------------------------------- /src/_assets/images/swup-logo-blue.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 13 | 18 | 21 | 24 | 26 | 28 | 29 | -------------------------------------------------------------------------------- /src/docs/api/helpers.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Helpers 4 | eleventyNavigation: 5 | key: Helpers 6 | parent: API 7 | order: 4 8 | description: Helpers that can be used for developing plugins, themes or anything else around swup 9 | permalink: /api/helpers/ 10 | --- 11 | 12 | # Helpers 13 | 14 | Helpers that can be used for developing plugins, themes or anything else around swup. 15 | 16 | ```javascript 17 | import { getCurrentUrl, updateHistoryRecord } from 'swup'; 18 | ``` 19 | 20 | ## Location 21 | 22 | A class used internally for parsing and passing around URLs. Very thin wrapper around the native `URL` object with an additional `url` getter for the path including query params. 23 | 24 | Parse a URL from a string: 25 | 26 | ```javascript 27 | const href = 'http://example.net/about#anchor'; 28 | const { url, hash } = Location.fromUrl(href); 29 | // url = /about 30 | // hash = #anchor 31 | ``` 32 | 33 | Parse a URL from a link element: 34 | 35 | ```javascript 36 | // const linkEl = 37 | const { url, hash } = Location.fromElement(linkEl); 38 | ``` 39 | 40 | ## classify 41 | 42 | Sanitize a string for use in CSS classnames or URL slugs. 43 | 44 | `Lorem ipsum` → `lorem-ipsum` 45 | 46 | ```javascript 47 | const className = classify('Lorem ipsum'); 48 | ``` 49 | 50 | ## createHistoryRecord 51 | 52 | Create a new history record via `history.pushState`, appending custom data as well as internal metadata that swup will recognize as its own. 53 | 54 | ```javascript 55 | createHistoryRecord('/new-page', { custom: 'data' }); 56 | ``` 57 | 58 | ## updateHistoryRecord 59 | 60 | Update the current history record via `history.replaceState`, adding custom data as well as internal metadata that swup will recognize as its own. 61 | 62 | ```javascript 63 | updateHistoryRecord(null, { custom: 'data' }); 64 | ``` 65 | 66 | ## delegateEvent 67 | 68 | Install a delegated event listener on the document using [delegate-it](https://github.com/fregante/delegate-it). 69 | 70 | ```javascript 71 | const delegation = delegateEvent('form', 'submit', (event) => { 72 | console.log('Form submitted'); 73 | }); 74 | ``` 75 | 76 | To stop listening for events, e.g. when unmounting a plugin: 77 | 78 | ```javascript 79 | delegation.destroy(); 80 | ``` 81 | 82 | ## getCurrentUrl 83 | 84 | Return the current page's url: pathname + query params. 85 | -------------------------------------------------------------------------------- /src/_includes/head.njk: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | {% if title %} 39 | {{ title }} — {{ site.title }} 40 | {% else %} 41 | {{ site.title }} — {{ site.description }} 42 | {% endif %} 43 | 44 | 45 | 46 | 47 | 48 | {% if site.ga_tracking != nil %} 49 | 50 | 58 | {% endif %} 59 | 60 | -------------------------------------------------------------------------------- /src/_assets/images/swup-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | swup-logo-white 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /lib/markdown-it-code-enhancements.js: -------------------------------------------------------------------------------- 1 | const { encode } = require('html-entities'); 2 | 3 | const synonyms = { 4 | javascript: 'js', 5 | bash: 'shell', 6 | } 7 | 8 | function renderCodeBlockRaw(code) { 9 | return /* html */`
${code}
`; 10 | } 11 | 12 | function renderCodeBlockWithLanguage(code, language) { 13 | return /*html*/ ` 14 |
15 | ${code} 16 | 19 |
`; 20 | } 21 | 22 | function renderSwupDemo(code) { 23 | const isSrc = (line) => line.startsWith('https://'); 24 | const lines = code.trim().split(/\r?\n/); 25 | const srcLine = lines.find(isSrc); 26 | if (!srcLine) { 27 | return renderCodeBlockRaw(code); 28 | } 29 | const src = srcLine.trim(); 30 | const path = new URL(src).pathname; 31 | const link = `https://github.com/swup/demos/tree/main${path}`; 32 | const description = lines.filter((line) => !isSrc(line)).join(' ').trim(); 33 | return /*html*/ ` 34 |
`; 44 | } 45 | 46 | function renderCodeBlock(originalRule) { 47 | return (...args) => { 48 | const [tokens, idx] = args; 49 | const content = tokens[idx].content; 50 | const info = tokens[idx].info; 51 | const language = synonyms[info] || info || 'unknown'; 52 | 53 | if (language === 'swupdemo') { 54 | return renderSwupDemo(content); 55 | } 56 | 57 | let code = originalRule(...args); 58 | // remove empty last lines 59 | code = code.replace(/<\/span>\s*$/, ''); 60 | if (content.length === 0) { 61 | return renderCodeBlockRaw(code); 62 | } else { 63 | return renderCodeBlockWithLanguage(code, language); 64 | } 65 | }; 66 | } 67 | 68 | module.exports = (markdownit) => { 69 | markdownit.renderer.rules.code_block = renderCodeBlock(markdownit.renderer.rules.code_block); 70 | markdownit.renderer.rules.fence = renderCodeBlock(markdownit.renderer.rules.fence); 71 | }; 72 | -------------------------------------------------------------------------------- /src/docs/other/ci-cd.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: CI/CD 4 | eleventyNavigation: 5 | key: CI/CD 6 | order: 9 7 | parent: Other 8 | description: You can test your site after each deployment, or as a part of the deploy process 9 | permalink: /ci-cd/ 10 | --- 11 | 12 | # CI/CD 13 | 14 | You can test your site after each deployment, or as a part of the deploy process. 15 | For this you can use [swup cli](/cli/), which now has a `validate` command with a bunch of options. 16 | 17 | Note that `validate` command runs test against a live site, while checking the pages in a headless browser. 18 | This means the site needs to be running on some domain, or can be temporarily started just for checks. 19 | You can use this docs site as an example, which is using a [CircleCI pipeline](https://github.com/swup/docs/blob/main/.circleci/config.yml) with [http-server package](https://github.com/swup/docs/blob/main/package.json#L20) to start a server and validate site on each PR. 20 | 21 | Instead of using the [command line options](/cli/), you can also define the options in a `swup.config.js` file in the root of your project. 22 | This file needs to default export an object, similar to the one below. 23 | This example also shows defaults which will be used if not defined in this file or through CLI option. 24 | 25 | ```javascript 26 | export default { 27 | // just some info about your swup setup so pages can be properly validated 28 | swup: { 29 | animationSelector: '[class*="swup-transition-"]', // animationSelector options of swup used in your project 30 | containers: ['#swup'] // containers options of swup used in your project 31 | }, 32 | // setup of your validation 33 | validate: { 34 | stylesExpectedToChange: ['opacity', 'transform'], // styles which are animated on your animated elements (checks that at least one is changed during animation) 35 | sitemap: 'public/sitemap.xml', // path or link to your sitemap 36 | urls: [], // set of URL - if set, swup CLI will check these URLs only (alternative to sitemap) 37 | baseUrl: '', // baseUrl of your site - if set, swup CLI will crawl the site for you, so you don't need to define URL manually (not referenced pages like 404 won't be checked) 38 | asynchronous: false, // can run all tests at once asynchronously (way faster, but might cause problems) 39 | runTests: 'all' // can run only one check instead of all (containers, transition-duration, transition-styles) 40 | } 41 | }; 42 | ``` 43 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/intro.scss: -------------------------------------------------------------------------------- 1 | .intro { 2 | position: relative; 3 | display: flex; 4 | align-items: center; 5 | justify-content: center; 6 | text-align: center; 7 | min-height: 100vh; 8 | min-height: 100svh; 9 | 10 | @at-root .light & { 11 | --color: var(--swup-blue); 12 | } 13 | color: var(--color); 14 | } 15 | 16 | .intro_background { 17 | position: absolute; 18 | inset: 0; 19 | 20 | background-size: 100vmax 100vmax; 21 | background-repeat: no-repeat; 22 | background-position: center; 23 | 24 | background-image: radial-gradient(hsl(239 50% 30% / 0.1), transparent 50%); 25 | 26 | @at-root .dark & { 27 | background-image: radial-gradient(rgb(255 255 255 / 0.1), transparent 50%); 28 | } 29 | } 30 | 31 | .intro, 32 | .intro * { 33 | transform-origin: top; 34 | } 35 | 36 | .intro_body { 37 | display: flex; 38 | flex-direction: column; 39 | align-items: center; 40 | justify-content: center; 41 | width: 80%; 42 | max-width: 600px; 43 | padding-block-start: calc(var(--gap-x2) + 1.5em); 44 | padding-block-end: var(--gap-x2); 45 | padding-inline: var(--size-fluid-3); 46 | position: relative; 47 | // transform: translateY(-5%); 48 | min-height: 100vh; 49 | min-height: 100svh; 50 | } 51 | 52 | .intro_slogan { 53 | margin-block: calc(var(--gap) * 1.5); 54 | font-size: var(--font-size-fluid-1); 55 | max-width: 500px; 56 | margin-inline: auto; 57 | font-weight: 500; 58 | line-height: 1.3; 59 | @include bp(m) { 60 | font-size: 1.6rem; 61 | margin-block: calc(var(--gap) * 1.25); 62 | } 63 | } 64 | 65 | .intro_logo { 66 | display: block; 67 | margin-inline: auto; 68 | width: 100%; 69 | @include mixins.aspectRatio(16, 6.9); 70 | position: relative; 71 | @at-root .dark & { 72 | filter: drop-shadow(4px 4px 1px rgba(0 0 0 / 0.4)); 73 | } 74 | @media screen and (orientation: landscape) { 75 | max-width: 60vw; 76 | } 77 | } 78 | 79 | .intro_logo .swup-logo { 80 | width: 100%; 81 | display: block; 82 | position: absolute; 83 | fill: currentColor; 84 | } 85 | 86 | .intro_announcement { 87 | position: fixed; 88 | top: 0; 89 | left: 50%; 90 | width: 100%; 91 | padding: var(--gap); 92 | transform: translateX(-50%); 93 | font-size: var(--font-size-fluid-1); 94 | max-width: 500px; 95 | margin-inline: auto; 96 | line-height: 1.3; 97 | font-weight: 500; 98 | margin-top: 0 !important; 99 | a { 100 | font-weight: 500; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/docs/themes/create-theme.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Create a theme 🎉 4 | eleventyNavigation: 5 | key: Create a theme 🎉 6 | parent: Themes 7 | order: 4 8 | description: Create your own theme 9 | permalink: /themes/create-theme/ 10 | --- 11 | 12 | # Create a Theme 13 | 14 | Anyone can create and publish swup themes. To create a new theme, install the [swup CLI](/cli/) 15 | and let it create one from a template. Or head over directly to the 16 | [theme template repo](https://github.com/swup/theme-template) and follow the instructions there. 17 | 18 | ## Tips 19 | 20 | - Check out existing themes before creating one. 21 | - If you think your new theme should be an official swup theme and live under the `@swup/*` npm namespace, get in touch at gmarcuk@gmail.com. 22 | 23 | ## Developing themes 24 | 25 | ### Accessing swup 26 | 27 | The swup instance is automatically assigned to the plugin instance and can be accessed as 28 | `this.swup` in the `mount` and `unmount` methods. 29 | 30 | ### Animation selector 31 | 32 | Swup themes automatically set the `animationSelector` option to `[class*="swup-transition-"]` to prevent bugs related to other libraries using the same classes. Use `swup-transition-*` for your theme classes. 33 | 34 | ### Bundled styles 35 | 36 | Use `.css` files to manage your styles. Import the styles directly into the JS bundle and 37 | apply it with `this.applyStyles(css)`; 38 | 39 | ### Customization 40 | 41 | The recommended way to make themes configurable is by using CSS custom properties that can be 42 | overridden by the users of the theme. Namespace them with the theme name to avoid collisions. 43 | 44 | ```css 45 | html { 46 | --swup-custom-theme-duration: .6s; 47 | --swup-custom-theme-color: red; 48 | } 49 | ``` 50 | 51 | Another way of configuring themes is by passing in an options object into the constructor, as is 52 | usual for plugins. 53 | 54 | ### Helpers 55 | 56 | Themes have a few special helper methods: 57 | 58 | - `applyStyles` to prepend a style tag with defined content in the head tag. 59 | - `addClassName` to add the `swup-transition-[name]` classname to an element. 60 | - `applyHTML` to append a `div` element with defined HTML content. 61 | 62 | ### Cleaning up 63 | 64 | Themes need to clean up after themselves in the `umount` method: cancel any event listeners, undo 65 | any DOM changes, etc. 66 | 67 | ### Logging 68 | 69 | Use swup's `log` method to output any relevant information. By default this method doesn't do 70 | anything. It will starting outputting information only if installed alongside the 71 | [debug plugin](/plugins/debug-plugin/). 72 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/search.scss: -------------------------------------------------------------------------------- 1 | button.search_toggle { 2 | @include bp(m) { 3 | padding-inline: 0.7em; 4 | } 5 | } 6 | button.search_toggle svg { 7 | position: relative; 8 | left: 0; 9 | top: 0; 10 | transform: none; 11 | } 12 | .search_toggle_label { 13 | margin-inline: 0.5em 3em; 14 | } 15 | .search_toggle_keys { 16 | font-size: 0.7em; 17 | opacity: 0.4; 18 | margin-inline-start: var(--button-height); 19 | margin-inline-end: calc(var(--button-height) * -0.1); 20 | } 21 | 22 | .search-modal { 23 | position: fixed; 24 | inset: 0; 25 | z-index: 100; 26 | } 27 | .search-modal_backdrop { 28 | position: absolute; 29 | inset: 0; 30 | background: rgb(0 0 0 / 0.8); 31 | z-index: -1; 32 | } 33 | .search-modal_panel { 34 | height: 100%; 35 | display: flex; 36 | justify-content: center; 37 | align-items: flex-start; 38 | padding: var(--gap-x2); 39 | overflow: auto; 40 | cursor: no-drop; 41 | // pointer-events: none; 42 | } 43 | .search-modal_body { 44 | border-radius: var(--radius-1); 45 | box-shadow: var(--shadow-1); 46 | background: var(--background); 47 | width: 100%; 48 | max-width: 600px; 49 | pointer-events: all; 50 | overflow: hidden; 51 | cursor: auto; 52 | } 53 | 54 | /* 55 | * Search UI 56 | */ 57 | .search_ui mark { 58 | font-weight: 700; 59 | background: none; 60 | color: inherit; 61 | } 62 | .search_ui_form { 63 | display: flex; 64 | align-items: center; 65 | padding: 1rem; 66 | } 67 | 68 | .search_ui_input { 69 | display: block; 70 | width: 100%; 71 | appearance: none; 72 | border: none; 73 | background: transparent; 74 | color: inherit; 75 | margin-left: 0.5rem; 76 | &:focus { 77 | outline: 0; 78 | } 79 | } 80 | 81 | .search_ui_no-results { 82 | border-top: 1px solid var(--color-transparent-1); 83 | padding-inline: 1rem; 84 | padding-block: 0.7rem 0.8rem; 85 | margin: 0; 86 | } 87 | 88 | .search_ui_results { 89 | list-style: none; 90 | padding: 0; 91 | margin: 0; 92 | user-select: none; 93 | } 94 | .search_ui_result_link { 95 | border-top: 1px solid var(--color-transparent-1); 96 | display: block; 97 | padding-inline: 1rem; 98 | padding-block: 1rem 1.3rem; 99 | @include mixins.hover { 100 | background: var(--color-transparent-1); 101 | } 102 | &:focus { 103 | outline: 0; 104 | background: var(--swup-red) !important; 105 | color: white !important; 106 | } 107 | } 108 | .search_ui_result_title { 109 | margin-block: 0; 110 | font-weight: 700; 111 | font-size: var(--font-size-fluid-1); 112 | } 113 | .search_ui_result_excerpt { 114 | margin-block: 0; 115 | font-size: 0.8rem; 116 | } 117 | -------------------------------------------------------------------------------- /src/_assets/scss/inc/buttons.scss: -------------------------------------------------------------------------------- 1 | button { 2 | appearance: none; 3 | cursor: pointer; 4 | background: none; 5 | border: none; 6 | color: inherit; 7 | font: inherit; 8 | * { 9 | pointer-events: none; 10 | } 11 | } 12 | 13 | .buttons { 14 | margin: 0; 15 | padding: 0; 16 | list-style: none; 17 | display: flex; 18 | gap: 0.7em; 19 | flex-wrap: wrap; 20 | font-size: clamp(0.8rem, 2vw, 1rem); 21 | } 22 | .button { 23 | display: inline-block; 24 | border-radius: var(--radius-round); 25 | background: var(--color-transparent-0); 26 | --button-height: 2.4em; 27 | @include bp(m) { 28 | --button-height: 2.6em; 29 | } 30 | --button-max-width: calc(100vw - var(--gap-x2)); 31 | --button-padding: 1.2em; 32 | @at-root .dark & { 33 | border: 1px solid var(--color-transparent-0); 34 | } 35 | height: var(--button-height); 36 | padding-inline: var(--button-padding); 37 | max-width: var(--button-max-width); 38 | display: flex; 39 | align-items: center; 40 | justify-content: flex-start; 41 | gap: 0.5em; 42 | font-weight: inherit; 43 | transition-property: background, color; 44 | transition-duration: 150ms; 45 | white-space: nowrap; 46 | cursor: pointer; 47 | font-weight: 500; 48 | @include mixins.hover { 49 | background: var(--color); 50 | color: var(--background); 51 | } 52 | > * { 53 | position: relative; 54 | top: -0.05em; 55 | cursor: pointer; 56 | } 57 | } 58 | 59 | .button svg { 60 | width: 1.2em; 61 | height: 1.2em; 62 | position: relative; 63 | flex: none; 64 | } 65 | .button:not(.button--circle) svg { 66 | &:first-child { 67 | margin-inline-start: calc(var(--button-padding) * -0.3); 68 | } 69 | &:last-child { 70 | margin-inline-end: calc(var(--button-padding) * -0.3); 71 | } 72 | } 73 | .button_label { 74 | max-width: calc(var(--button-max-width, 3000px) - var(--button-height)); 75 | overflow: hidden; 76 | text-overflow: ellipsis; 77 | } 78 | 79 | @include bp(m, max) { 80 | .header .buttons { 81 | gap: 0.2rem; 82 | } 83 | .header .button { 84 | background: none; 85 | border: none; 86 | } 87 | .header .button svg { 88 | width: 1.3rem; 89 | height: 1.3rem; 90 | } 91 | } 92 | 93 | .button--search { 94 | font-weight: normal; 95 | } 96 | 97 | .button--circle { 98 | padding: 0; 99 | width: var(--button-height); 100 | height: var(--button-height); 101 | justify-content: center; 102 | } 103 | 104 | .buttons--large { 105 | font-size: clamp(1rem, 3vw, 1.35rem); 106 | .button { 107 | padding-inline: calc(1em + var(--button-height) * 0.3); 108 | font-weight: 500; 109 | } 110 | } 111 | .buttons--centered { 112 | justify-content: center; 113 | } 114 | 115 | .button--filled { 116 | background: var(--color); 117 | color: var(--background); 118 | } 119 | -------------------------------------------------------------------------------- /src/_assets/images/swup-logo-no-dots.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/_includes/search.njk: -------------------------------------------------------------------------------- 1 | 86 | -------------------------------------------------------------------------------- /src/docs/other/minimal-reproduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Minimal Reproductions 4 | eleventyNavigation: false 5 | description: Please include a Minimal Reproduction 6 | permalink: /other/minimal-reproductions/ 7 | --- 8 | 9 | # How to Create a Minimal Reproduction 10 | 11 | The swup maintainers may ask you to create a "minimal reproduction" or "reduced test case" when 12 | asking for help or reporting an issue. **Issues without a reproduction may be temporarily closed.** Here's why: 13 | 14 | ## Why you should create a minimal reproduction 15 | 16 | Providing a minimal reproduction means **everyone puts in a fair amount of effort**. 17 | 18 | By creating a minimal reproduction, you enable us to: 19 | 20 | - Fix your bug faster 21 | - Work on your feature request faster 22 | - Confirm the cause of the behavior 23 | 24 | ## What is a minimal reproduction? 25 | 26 | A minimal reproduction is a **simplified version of your code to demonstrate a problem**. It should use 27 | the smallest amount of code and configuration needed to clearly show the problem. All features and 28 | dependencies not related to the issue should be removed. 29 | 30 | A minimal reproduction is the best way to help people that want to help *you*. 31 | 32 | ## How to create a minimal reproduction 33 | 34 | 1. Create a new project. See below for suggested services for hosting it. 35 | 2. Install swup and any plugins needed to demonstrate the problem. 36 | 3. Add the code needed to recreate the error you’re seeing. 37 | 4. Strip away unrelated code to focus solely on the issue. 38 | 5. Confirm that the error can be consistently reproduced with your provided code. 39 | 6. Publish the project and provide a link to it when creating an issue. 40 | 41 | ## Where to host a minimal reproduction 42 | 43 | You can use one of the many available online IDEs to create a reproduction, e.g. 44 | [CodeSandbox](https://codesandbox.io/p/sandbox/swup-4-minimal-reproduction-template-n6kgnp), 45 | [Replit](https://replit.com/@swupjs/Swup-Test-Case-Template), or 46 | [StackBlitz](https://stackblitz.com/). The important part is that it's easily accessible to 47 | maintainers and doesn't require manual setup. 48 | 49 | ## Even better, submit a test case or a solution! 50 | 51 | As Rich Harris [points out](https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d70ff#better-still-file-a-test-case-or-a-fix), maintainers appreciate it when you **contribute test cases and solutions through pull requests**. Straightforward fixes (that meet the project's code standards and pass the CI) are highly valued. 52 | 53 | ## ”But it's too much work to create a minimal reproduction“ 🥵 54 | 55 | **It’s almost impossible to fix a bug without first being able to reliably reproduce it**. That's why we prioritize working on issues with a minimal reproduction, as they allow us to spend our time more efficiently. 56 | 57 | ## “But I already described everything in the issue” 😒 58 | 59 | We appreciate you describing the issue in detail! However, **a minimal reproduction will make sure 60 | that your description matches the actual behavior**, by removing everything but the necessary code. 61 | -------------------------------------------------------------------------------- /src/docs/api/markup.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Markup 4 | eleventyNavigation: 5 | key: Markup 6 | parent: API 7 | order: 6 8 | description: Influence swup behavior with DOM attributes 9 | permalink: /api/markup/ 10 | --- 11 | 12 | # Markup 13 | 14 | Control swup's behavior using specific DOM attributes on links and other elements. 15 | 16 | ## Ignore links 17 | 18 | Swup can be disabled on a per-link basis by annotating a link with `data-no-swup`. 19 | 20 | ```html 21 | Ignored 22 | ``` 23 | 24 | Add the attribute to a common container to ignore all links within. 25 | 26 | ```html 27 |
28 | Ignored 29 | Ignored 30 |
31 | ``` 32 | 33 | ## Set a custom animation 34 | 35 | Set a custom animation for a specific link by adding a `data-swup-animation` attribute. 36 | 37 | ```html 38 | 39 | ``` 40 | 41 | This will add a `.to-{animation}` class on the HTML element during the visit you can 42 | use to specify custom transition styles: 43 | 44 | ```html 45 | 46 | ``` 47 | 48 | ```css 49 | html.is-changing .transition-page { 50 | /* normal transition styles */ 51 | } 52 | html.is-changing.to-slide .transition-page { 53 | /* slide transition styles */ 54 | } 55 | ``` 56 | 57 | Add the attribute to a common container to set an animation for all links within. Animations defined 58 | on a link take precedence over animations defined on a parent. 59 | 60 | ```html 61 |
62 | Slide 63 | Slide 64 | Fade 65 |
66 | ``` 67 | 68 | ## Persist element state 69 | 70 | Some elements need to keep their state between page loads, e.g. autoplaying videos, animations or 71 | countdowns. Swup will transfer an element to the next page — preserving its content, data and 72 | event listeners — if it has a `data-swup-persist` attribute and a matching element is found on the 73 | next page. Elements are matched using the unique value of the persist attribute. 74 | 75 | ```html 76 |