Showing preview only (400K chars total). Download the full file or copy to clipboard to get everything.
Repository: barbajs/barba
Branch: main
Commit: a7c99a5557be
Files: 210
Total size: 353.7 KB
Directory structure:
gitextract_lsxzgmju/
├── .all-contributorsrc
├── .circleci/
│ └── config.yml
├── .editorconfig
├── .eslintrc.js
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug-report.yml
│ │ └── config.yml
│ └── stale.yml
├── .gitignore
├── .lintstagedrc
├── .markdownlint.json
├── .vscode/
│ └── settings.json
├── AUTHORS
├── CI.md
├── LICENSE.md
├── NOTES.md
├── README.md
├── TODO.md
├── commitlint.config.js
├── cypress/
│ ├── fixtures/
│ │ └── example.json
│ ├── plugins/
│ │ └── index.js
│ └── support/
│ ├── commands.js
│ └── e2e.js
├── cypress.config.ts
├── documentation/
│ └── theme/
│ ├── assets/
│ │ └── css/
│ │ └── override.css
│ └── layouts/
│ └── default.hbs
├── jest.config.js
├── lerna.json
├── package.json
├── packages/
│ ├── core/
│ │ ├── .npmignore
│ │ ├── AUTHORS
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── __e2e__/
│ │ │ ├── container.spec.js
│ │ │ ├── default.spec.js
│ │ │ ├── hooks.spec.js
│ │ │ ├── href.spec.js
│ │ │ └── views.spec.js
│ │ ├── __mocks__/
│ │ │ ├── barba.ts
│ │ │ └── transitions.ts
│ │ ├── __tests__/
│ │ │ ├── core/
│ │ │ │ ├── core.click.test.ts
│ │ │ │ ├── core.enter.test.ts
│ │ │ │ ├── core.force.test.ts
│ │ │ │ ├── core.go.test.ts
│ │ │ │ ├── core.init.test.ts
│ │ │ │ ├── core.logger.test.ts
│ │ │ │ ├── core.once.test.ts
│ │ │ │ ├── core.page.test.ts
│ │ │ │ ├── core.plugin.test.ts
│ │ │ │ ├── core.popstate.test.ts
│ │ │ │ ├── core.prefetch.test.ts
│ │ │ │ ├── core.requestError.test.ts
│ │ │ │ └── core.test.ts
│ │ │ ├── hooks/
│ │ │ │ └── hooks.test.ts
│ │ │ ├── modules/
│ │ │ │ ├── cache.test.ts
│ │ │ │ ├── error.test.ts
│ │ │ │ ├── headers.test.ts
│ │ │ │ ├── ignore.test.ts
│ │ │ │ ├── logger.test.ts
│ │ │ │ ├── prevent/
│ │ │ │ │ ├── prevent.blank.test.ts
│ │ │ │ │ ├── prevent.corsDomain.test.ts
│ │ │ │ │ ├── prevent.corsPort.test.ts
│ │ │ │ │ ├── prevent.download.test.ts
│ │ │ │ │ ├── prevent.exists.test.ts
│ │ │ │ │ ├── prevent.newTab.test.ts
│ │ │ │ │ ├── prevent.preventAll.test.ts
│ │ │ │ │ ├── prevent.preventSelf.test.ts
│ │ │ │ │ ├── prevent.sameUrl.test.ts
│ │ │ │ │ └── prevent.test.ts
│ │ │ │ ├── store/
│ │ │ │ │ ├── store.add.test.ts
│ │ │ │ │ ├── store.addPriority.test.ts
│ │ │ │ │ ├── store.check.test.ts
│ │ │ │ │ ├── store.log.test.ts
│ │ │ │ │ ├── store.resolve.once.test.ts
│ │ │ │ │ ├── store.resolve.page.test.ts
│ │ │ │ │ ├── store.test.ts
│ │ │ │ │ ├── store.update.sort.test.ts
│ │ │ │ │ └── store.update.test.ts
│ │ │ │ ├── transitions/
│ │ │ │ │ ├── transitions.async.test.ts
│ │ │ │ │ ├── transitions.context.test.ts
│ │ │ │ │ ├── transitions.get.test.ts
│ │ │ │ │ ├── transitions.once.test.ts
│ │ │ │ │ ├── transitions.page.test.ts
│ │ │ │ │ └── transitions.test.ts
│ │ │ │ └── views.test.ts
│ │ │ └── utils/
│ │ │ ├── dom.test.ts
│ │ │ ├── history.test.ts
│ │ │ ├── request.test.ts
│ │ │ └── url.test.ts
│ │ ├── __web__/
│ │ │ ├── container.html
│ │ │ ├── href.html
│ │ │ ├── index.html
│ │ │ ├── page.html
│ │ │ ├── scripts/
│ │ │ │ ├── container.js
│ │ │ │ ├── default.js
│ │ │ │ ├── href.js
│ │ │ │ ├── transitions/
│ │ │ │ │ └── hooks.js
│ │ │ │ ├── views/
│ │ │ │ │ └── hooks.js
│ │ │ │ └── views.js
│ │ │ └── views.html
│ │ ├── jest.config.js
│ │ ├── package.json
│ │ └── src/
│ │ ├── core.ts
│ │ ├── defs/
│ │ │ ├── barba.ts
│ │ │ ├── cache.ts
│ │ │ ├── dom.ts
│ │ │ ├── global.ts
│ │ │ ├── headers.ts
│ │ │ ├── history.ts
│ │ │ ├── hooks.ts
│ │ │ ├── ignore.ts
│ │ │ ├── index.ts
│ │ │ ├── is-promise.d.ts
│ │ │ ├── prevent.ts
│ │ │ ├── request.ts
│ │ │ ├── rules.ts
│ │ │ ├── schemas.ts
│ │ │ ├── transition.ts
│ │ │ ├── url.ts
│ │ │ └── view.ts
│ │ ├── hooks.ts
│ │ ├── index.ts
│ │ ├── modules/
│ │ │ ├── Cache.ts
│ │ │ ├── Error.ts
│ │ │ ├── Headers.ts
│ │ │ ├── Ignore.ts
│ │ │ ├── Logger.ts
│ │ │ ├── Prevent.ts
│ │ │ ├── Store.ts
│ │ │ ├── Transitions.ts
│ │ │ └── Views.ts
│ │ ├── polyfills/
│ │ │ └── index.ts
│ │ ├── schemas/
│ │ │ ├── attribute.ts
│ │ │ └── page.ts
│ │ ├── typings.ts
│ │ └── utils/
│ │ ├── dom.ts
│ │ ├── helpers.ts
│ │ ├── history.ts
│ │ ├── index.ts
│ │ ├── request.ts
│ │ ├── run-async.ts
│ │ └── url.ts
│ ├── css/
│ │ ├── .npmignore
│ │ ├── AUTHORS
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── __e2e__/
│ │ │ ├── default.spec.js
│ │ │ ├── named.spec.js
│ │ │ └── once.spec.js
│ │ ├── __tests__/
│ │ │ ├── css.classes.test.ts
│ │ │ ├── css.hooks.test.ts
│ │ │ ├── css.init.test.ts
│ │ │ ├── css.prefix.test.ts
│ │ │ └── css.states.test.ts
│ │ ├── __web__/
│ │ │ ├── index.html
│ │ │ ├── named.html
│ │ │ ├── once.html
│ │ │ ├── page.html
│ │ │ ├── scripts/
│ │ │ │ ├── default.js
│ │ │ │ └── named.js
│ │ │ └── styles/
│ │ │ ├── default.css
│ │ │ ├── named.css
│ │ │ └── once.css
│ │ ├── jest.config.js
│ │ ├── package.json
│ │ └── src/
│ │ ├── css.ts
│ │ ├── defs/
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ └── typings.ts
│ ├── prefetch/
│ │ ├── .npmignore
│ │ ├── AUTHORS
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── __e2e__/
│ │ │ └── prefetch.spec.js
│ │ ├── __tests__/
│ │ │ └── prefetch.init.test.ts
│ │ ├── __web__/
│ │ │ └── index.html
│ │ ├── jest.config.js
│ │ ├── package.json
│ │ └── src/
│ │ ├── defs/
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ ├── polyfills/
│ │ │ ├── index.ts
│ │ │ └── requestIdleCallback.ts
│ │ ├── prefetch.ts
│ │ └── typings.ts
│ └── router/
│ ├── .npmignore
│ ├── AUTHORS
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── __e2e__/
│ │ └── default.spec.js
│ ├── __tests__/
│ │ └── router.test.ts
│ ├── __web__/
│ │ ├── default.html
│ │ ├── index.html
│ │ ├── page.html
│ │ └── scripts/
│ │ └── default.js
│ ├── jest.config.js
│ ├── package.json
│ └── src/
│ ├── defs/
│ │ └── index.ts
│ ├── index.ts
│ ├── router.ts
│ └── typings.ts
├── prettier.config.js
├── tsconfig.json
├── tslint.json
└── typedoc.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .all-contributorsrc
================================================
{
"projectName": "barba",
"projectOwner": "barbajs",
"repoType": "github",
"repoHost": "https://github.com",
"files": ["README.md"],
"imageSize": 100,
"commit": true,
"commitTemplate": "docs(root): :busts_in_silhouette: <%= (newContributor ? 'add' : 'update') %> @<%= username %> as a contributor",
"contributorsPerLine": 7,
"contributors": [
{
"login": "luruke",
"name": "Luigi De Rosa",
"avatar_url": "https://avatars0.githubusercontent.com/u/61326?v=4",
"profile": "http://luruke.com",
"contributions": [
"ideas",
"code",
"doc",
"question",
"bug",
"test",
"review",
"infra"
]
},
{
"login": "thierrymichel",
"name": "Thierry Michel",
"avatar_url": "https://avatars2.githubusercontent.com/u/806883?v=4",
"profile": "http://thierrymichel.net",
"contributions": [
"ideas",
"code",
"doc",
"question",
"bug",
"test",
"review",
"infra"
]
},
{
"login": "xavierfoucrier",
"name": "Xavier Foucrier",
"avatar_url": "https://avatars1.githubusercontent.com/u/2471223?v=4",
"profile": "https://xavierfoucrier.dev",
"contributions": [
"ideas",
"code",
"doc",
"question",
"test",
"review",
"bug",
"infra"
]
},
{
"login": "markog85",
"name": "Marco Grimaldi",
"avatar_url": "https://avatars2.githubusercontent.com/u/858150?v=4",
"profile": "http://www.thenerodesign.com",
"contributions": ["design"]
},
{
"login": "Ihatetomatoes",
"name": "Petr TIchy",
"avatar_url": "https://avatars1.githubusercontent.com/u/735672?v=4",
"profile": "https://ihatetomatoes.net",
"contributions": ["blog", "tutorial", "video"]
},
{
"login": "c0mrx",
"name": "Cody Marcoux",
"avatar_url": "https://avatars0.githubusercontent.com/u/22644154?v=4",
"profile": "https://studio123.ca",
"contributions": ["question"]
},
{
"login": "wiseoldman",
"name": "Phil.",
"avatar_url": "https://avatars1.githubusercontent.com/u/3285136?v=4",
"profile": "https://philiphussak.com",
"contributions": ["question"]
},
{
"login": "gfnool",
"name": "Giorgio Finulli",
"avatar_url": "https://avatars0.githubusercontent.com/u/5812801?v=4",
"profile": "http://www.fnool.com",
"contributions": ["question"]
},
{
"login": "Wouter125",
"name": "Wouter",
"avatar_url": "https://avatars2.githubusercontent.com/u/6507123?v=4",
"profile": "https://www.thisisnota.studio",
"contributions": ["bug", "question"]
},
{
"login": "mikehwagz",
"name": "Mike Wagz",
"avatar_url": "https://avatars2.githubusercontent.com/u/12376535?v=4",
"profile": "https://selfaware.studio",
"contributions": ["ideas", "question", "test"]
},
{
"login": "theredstapler",
"name": "Red Stapler",
"avatar_url": "https://avatars0.githubusercontent.com/u/16864380?v=4",
"profile": "https://www.youtube.com/c/redstapler_channel",
"contributions": ["tutorial", "video"]
},
{
"login": "19h47",
"name": "Jérémy Levron",
"avatar_url": "https://avatars1.githubusercontent.com/u/11242861?v=4",
"profile": "http://www.19h47.fr",
"contributions": ["question"]
},
{
"login": "anhskohbo",
"name": "Nguyen Van Anh",
"avatar_url": "https://avatars2.githubusercontent.com/u/1529454?v=4",
"profile": "http://anhskohbo.github.io/",
"contributions": ["code"]
},
{
"login": "dlwebdev",
"name": "Daniel Weber",
"avatar_url": "https://avatars1.githubusercontent.com/u/668910?v=4",
"profile": "http://www.thedanielweber.com",
"contributions": ["code"]
},
{
"login": "jmporchet",
"name": "Jean-Marie Porchet",
"avatar_url": "https://avatars3.githubusercontent.com/u/3099008?v=4",
"profile": "http://www.jmporchet.ch",
"contributions": ["code"]
},
{
"login": "docherty",
"name": "James",
"avatar_url": "https://avatars1.githubusercontent.com/u/325490?v=4",
"profile": "https://www.jamesdocherty.com/",
"contributions": ["code"]
},
{
"login": "nicholasruggeri",
"name": "Nicholas",
"avatar_url": "https://avatars0.githubusercontent.com/u/999162?v=4",
"profile": "http://ruggeri.io",
"contributions": ["code"]
},
{
"login": "patrick91",
"name": "Patrick Arminio",
"avatar_url": "https://avatars1.githubusercontent.com/u/667029?v=4",
"profile": "http://patrick.wtf",
"contributions": ["code"]
},
{
"login": "angelogulina",
"name": "A (from Sicily)",
"avatar_url": "https://avatars0.githubusercontent.com/u/4223655?v=4",
"profile": "https://angelogulina.it",
"contributions": ["code"]
},
{
"login": "pavel-mazhuga",
"name": "Pavel Mazhuga",
"avatar_url": "https://avatars3.githubusercontent.com/u/29140681?v=4",
"profile": "https://github.com/pavel-mazhuga",
"contributions": ["question"]
},
{
"login": "DMDc0de",
"name": "Daniele De Matteo",
"avatar_url": "https://avatars0.githubusercontent.com/u/7113516?v=4",
"profile": "http://dmdcode.it",
"contributions": ["question"]
},
{
"login": "aswinkumar863",
"name": "aswinkumar863",
"avatar_url": "https://avatars0.githubusercontent.com/u/32381261?v=4",
"profile": "https://github.com/aswinkumar863",
"contributions": ["question"]
},
{
"login": "BounceIncHQ",
"name": "BounceIncHQ",
"avatar_url": "https://avatars0.githubusercontent.com/u/39249876?v=4",
"profile": "https://github.com/BounceIncHQ",
"contributions": ["question"]
},
{
"login": "gordonwes",
"name": "gordonwes",
"avatar_url": "https://avatars3.githubusercontent.com/u/10758596?v=4",
"profile": "https://github.com/gordonwes",
"contributions": ["question"]
},
{
"login": "evfleet",
"name": "Evan Fleet",
"avatar_url": "https://avatars2.githubusercontent.com/u/7504632?v=4",
"profile": "https://github.com/evfleet",
"contributions": ["question", "bug"]
},
{
"login": "jd4Aligator",
"name": "Jörg",
"avatar_url": "https://avatars2.githubusercontent.com/u/32126746?v=4",
"profile": "http://www.aligator-kom.de",
"contributions": ["example"]
},
{
"login": "StudioZAAK",
"name": "ZAAK",
"avatar_url": "https://avatars3.githubusercontent.com/u/12050808?v=4",
"profile": "http://www.zaak.ch",
"contributions": ["example", "question"]
},
{
"login": "leapincorp",
"name": "Masahiro Tonomura",
"avatar_url": "https://avatars1.githubusercontent.com/u/42055102?v=4",
"profile": "https://leap-in.com",
"contributions": ["example"]
},
{
"login": "CassiusHR",
"name": "CassiusHR",
"avatar_url": "https://avatars1.githubusercontent.com/u/24419585?v=4",
"profile": "https://github.com/CassiusHR",
"contributions": ["question"]
},
{
"login": "shanewmurphy",
"name": "Shane Murphy",
"avatar_url": "https://avatars2.githubusercontent.com/u/3694619?v=4",
"profile": "http://www.shanemurphy.me",
"contributions": ["question"]
},
{
"login": "watzing",
"name": "Dylan Reeves",
"avatar_url": "https://avatars3.githubusercontent.com/u/1294637?v=4",
"profile": "http://www.dylanreeves.com",
"contributions": ["question", "example"]
},
{
"login": "quentinneyraud",
"name": "Quentin Neyraud",
"avatar_url": "https://avatars2.githubusercontent.com/u/9378568?v=4",
"profile": "http://www.quentinneyraud.fr",
"contributions": ["question"]
},
{
"login": "tortilaman",
"name": "tortilaman",
"avatar_url": "https://avatars2.githubusercontent.com/u/5018268?v=4",
"profile": "https://github.com/tortilaman",
"contributions": ["question"]
},
{
"login": "psntr",
"name": "psntr",
"avatar_url": "https://avatars2.githubusercontent.com/u/20617539?v=4",
"profile": "https://github.com/psntr",
"contributions": ["question"]
},
{
"login": "thisbailiwick",
"name": "Kevin Clark",
"avatar_url": "https://avatars3.githubusercontent.com/u/12637253?v=4",
"profile": "http://thisbailiwick.com",
"contributions": ["question"]
},
{
"login": "Tedowski",
"name": "Tadeas Kosek",
"avatar_url": "https://avatars2.githubusercontent.com/u/26543624?v=4",
"profile": "http://takodesign.one",
"contributions": ["question"]
},
{
"login": "gustavo-a",
"name": "Gustavo de Andrade",
"avatar_url": "https://avatars2.githubusercontent.com/u/26806307?v=4",
"profile": "https://github.com/gustavo-a",
"contributions": ["question"]
},
{
"login": "crobbinsdg",
"name": "Clinton",
"avatar_url": "https://avatars0.githubusercontent.com/u/25391588?v=4",
"profile": "https://durkangroup.com/",
"contributions": ["question"]
},
{
"login": "magicspon",
"name": "Dave Stockley",
"avatar_url": "https://avatars3.githubusercontent.com/u/3268717?v=4",
"profile": "https://www.spon.io",
"contributions": ["question"]
},
{
"login": "khaiknievel",
"name": "khaiknievel",
"avatar_url": "https://avatars1.githubusercontent.com/u/5792500?v=4",
"profile": "http://khaiknievel.carbonmade.com",
"contributions": ["question", "bug"]
},
{
"login": "kekkorider",
"name": "Francesco Michelini",
"avatar_url": "https://avatars3.githubusercontent.com/u/5191941?v=4",
"profile": "http://www.francescomichelini.com/",
"contributions": ["question", "example"]
},
{
"login": "FistMeNaruto",
"name": "Domantas Petrauskas",
"avatar_url": "https://avatars1.githubusercontent.com/u/13431677?v=4",
"profile": "https://github.com/FistMeNaruto",
"contributions": ["question"]
},
{
"login": "kjbrum",
"name": "Kyle Brumm",
"avatar_url": "https://avatars3.githubusercontent.com/u/1709677?v=4",
"profile": "http://kylebrumm.com",
"contributions": ["question"]
},
{
"login": "obelmont",
"name": "Oliver Belmont",
"avatar_url": "https://avatars3.githubusercontent.com/u/6540497?v=4",
"profile": "https://github.com/obelmont",
"contributions": ["question"]
},
{
"login": "lunelson",
"name": "Lu Nelson",
"avatar_url": "https://avatars1.githubusercontent.com/u/1242864?v=4",
"profile": "https://lunelson.xyz/",
"contributions": ["question"]
},
{
"login": "bramcordie",
"name": "Bram Cordie",
"avatar_url": "https://avatars1.githubusercontent.com/u/1107185?v=4",
"profile": "http://bierdb.be",
"contributions": ["question", "ideas"]
},
{
"login": "metalmini",
"name": "Michael Schouman",
"avatar_url": "https://avatars1.githubusercontent.com/u/510652?v=4",
"profile": "http://portfolio.schouman.info",
"contributions": ["question"]
},
{
"login": "JumpLink",
"name": "Pascal Garber",
"avatar_url": "https://avatars2.githubusercontent.com/u/1073989?v=4",
"profile": "https://www.jumplink.eu",
"contributions": ["question", "ideas"]
},
{
"login": "bfred-it",
"name": "Federico Brigante",
"avatar_url": "https://avatars3.githubusercontent.com/u/1402241?v=4",
"profile": "https://twitter.com/bfred_it",
"contributions": ["question"]
},
{
"login": "factorzero",
"name": "Corey Lee",
"avatar_url": "https://avatars1.githubusercontent.com/u/1465865?v=4",
"profile": "http://coreylee.tokyo/",
"contributions": ["question"]
},
{
"login": "mbsimonovic",
"name": "Milan Simonovic",
"avatar_url": "https://avatars3.githubusercontent.com/u/888008?v=4",
"profile": "http://www.imls.uzh.ch/research/vonmering/people/milan-simonovic.html",
"contributions": ["question"]
},
{
"login": "Djules",
"name": "Julien Vasseur",
"avatar_url": "https://avatars1.githubusercontent.com/u/196644?v=4",
"profile": "http://djul.es",
"contributions": ["question"]
},
{
"login": "panwron",
"name": "Maciej Wrona",
"avatar_url": "https://avatars2.githubusercontent.com/u/8494786?v=4",
"profile": "https://github.com/panwron",
"contributions": ["question"]
},
{
"login": "terion-name",
"name": "Terion",
"avatar_url": "https://avatars0.githubusercontent.com/u/1060205?v=4",
"profile": "http://terion.name",
"contributions": ["ideas"]
},
{
"login": "cartogram",
"name": "Matt Seccafien",
"avatar_url": "https://avatars2.githubusercontent.com/u/462077?v=4",
"profile": "https://github.com/cartogram",
"contributions": ["ideas"]
},
{
"login": "max-schu",
"name": "Max Schulmeister",
"avatar_url": "https://avatars2.githubusercontent.com/u/15388185?v=4",
"profile": "http://www.maxschulmeister.com",
"contributions": ["ideas"]
},
{
"login": "tipsy",
"name": "David",
"avatar_url": "https://avatars3.githubusercontent.com/u/1521451?v=4",
"profile": "https://davidaase.com",
"contributions": ["ideas"]
},
{
"login": "pierrehenri220",
"name": "Pierre-Henri Lavigne",
"avatar_url": "https://avatars3.githubusercontent.com/u/19267400?v=4",
"profile": "https://github.com/pierrehenri220",
"contributions": ["ideas"]
},
{
"login": "lsbyerley",
"name": "lsbyerley",
"avatar_url": "https://avatars0.githubusercontent.com/u/3066258?v=4",
"profile": "https://github.com/lsbyerley",
"contributions": ["ideas"]
},
{
"login": "theamnesic",
"name": "Guillaume M.",
"avatar_url": "https://avatars2.githubusercontent.com/u/242203?v=4",
"profile": "http://gmorisseau.com/",
"contributions": ["ideas"]
},
{
"login": "oscarotero",
"name": "Oscar Otero",
"avatar_url": "https://avatars3.githubusercontent.com/u/377873?v=4",
"profile": "https://oscarotero.com",
"contributions": ["ideas"]
},
{
"login": "nicooprat",
"name": "Nico Prat",
"avatar_url": "https://avatars0.githubusercontent.com/u/645641?v=4",
"profile": "http://twitter.com/nicooprat",
"contributions": ["ideas"]
},
{
"login": "dwightjack",
"name": "Marco Solazzi",
"avatar_url": "https://avatars2.githubusercontent.com/u/104721?v=4",
"profile": "http://marco.solazzi.me/",
"contributions": ["bug"]
},
{
"login": "atoupet-toki",
"name": "atoupet-toki",
"avatar_url": "https://avatars3.githubusercontent.com/u/38693082?v=4",
"profile": "https://github.com/atoupet-toki",
"contributions": ["bug"]
},
{
"login": "josias-r",
"name": "Josias",
"avatar_url": "https://avatars1.githubusercontent.com/u/11424820?v=4",
"profile": "https://github.com/josias-r",
"contributions": ["bug"]
},
{
"login": "OksanaRomaniv",
"name": "Oksana Romaniv",
"avatar_url": "https://avatars1.githubusercontent.com/u/5724727?v=4",
"profile": "https://github.com/OksanaRomaniv",
"contributions": ["bug"]
},
{
"login": "oguilleux",
"name": "Olivier Guilleux",
"avatar_url": "https://avatars3.githubusercontent.com/u/5804006?v=4",
"profile": "https://www.olivier-guilleux.com",
"contributions": ["bug"]
},
{
"login": "Liroo",
"name": "Liroo Pierre ᵈᵉᵛ",
"avatar_url": "https://avatars3.githubusercontent.com/u/11197281?v=4",
"profile": "http://liroopierre.com",
"contributions": ["code"]
},
{
"login": "lmartins",
"name": "Luis Martins",
"avatar_url": "https://avatars2.githubusercontent.com/u/151981?v=4",
"profile": "https://github.com/lmartins",
"contributions": ["bug"]
},
{
"login": "matthewjumpsoffbuildings",
"name": "Matthew",
"avatar_url": "https://avatars0.githubusercontent.com/u/41524?v=4",
"profile": "https://arraytheband.com.au",
"contributions": ["ideas", "question"]
},
{
"login": "Slgoetz",
"name": "Simon Goetz",
"avatar_url": "https://avatars0.githubusercontent.com/u/393000?v=4",
"profile": "http://slgoetz.com",
"contributions": ["bug"]
},
{
"login": "luis-pt",
"name": "Luís Carvalho",
"avatar_url": "https://avatars3.githubusercontent.com/u/14956453?v=4",
"profile": "https://luis.pt",
"contributions": ["question"]
},
{
"login": "mrsamse",
"name": "Samuel Berisha",
"avatar_url": "https://avatars2.githubusercontent.com/u/20925205?v=4",
"profile": "https://github.com/mrsamse",
"contributions": ["question"]
},
{
"login": "andersonleite",
"name": "Anderson Leite",
"avatar_url": "https://avatars.githubusercontent.com/u/52427?v=4",
"profile": "https://github.com/andersonleite",
"contributions": ["question", "bug"]
},
{
"login": "JayBox325",
"name": "Jay Collett",
"avatar_url": "https://avatars.githubusercontent.com/u/13233809?v=4",
"profile": "https://jaycollett.co/",
"contributions": ["question", "bug"]
},
{
"login": "timgates42",
"name": "Tim Gates",
"avatar_url": "https://avatars.githubusercontent.com/u/47873678?v=4",
"profile": "https://github.com/timgates42",
"contributions": ["bug"]
},
{
"login": "nicolas-cusan",
"name": "Nicolas Cusan",
"avatar_url": "https://avatars.githubusercontent.com/u/1353931?v=4",
"profile": "https://www.nicolascusan.com/",
"contributions": ["question", "bug", "code"]
},
{
"login": "geraldnako",
"name": "Gerald Nako",
"avatar_url": "https://avatars.githubusercontent.com/u/5095859?v=4",
"profile": "https://geraldnako.com/",
"contributions": ["bug", "code"]
}
],
"commitConvention": "angular"
}
================================================
FILE: .circleci/config.yml
================================================
version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: cimg/node:20.4
# Not working: Job \"build\" has filters configured in the job definition. These filters are incompatible with workflows.
# branches:
# only:
# - main
jobs:
build:
<<: *defaults
resource_class: large
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- restore_cache:
name: Restore Node modules
keys:
- dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- persist_to_workspace:
root: ~/repo
paths:
- node_modules
test:
<<: *defaults
resource_class: large
steps:
- checkout
- attach_workspace:
at: ~/repo
- run:
name: Lint
command: yarn lint
- run:
name: Bundle
command: yarn build
- run:
name: Test
command: yarn unit:ci
- run:
name: Coverage
command: yarn coverage
- store_artifacts:
path: coverage
- persist_to_workspace:
root: ~/repo
paths:
- node_modules
docs-build:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/repo
- run:
name: Build docs
command: yarn doc
- persist_to_workspace:
root: ~/repo
paths: [documentation]
docs-deploy:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/repo
- run:
name: Install and configure dependencies
command: |
yarn add gh-pages@2.0.1 -W
git config user.email $GH_EMAIL
git config user.name $GH_NAME
- add_ssh_keys:
fingerprints:
- '2c:bd:91:1f:35:54:de:94:22:77:fc:3e:68:f9:6b:2f'
- run:
name: Deploy docs to gh-pages branch
command: ./node_modules/.bin/gh-pages -d documentation/api -e api -m 'Deploy docs [ci skip]'
workflows:
version: 2
build_and_test:
jobs:
- build:
filters:
branches:
only:
- main
- dev
- test:
requires:
- build
filters:
branches:
only:
- main
- dev
- docs-build:
requires:
- test
filters:
branches:
only:
- main
- dev
- docs-deploy:
requires:
- docs-build
filters:
branches:
only: main
================================================
FILE: .editorconfig
================================================
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
indent_size = 4
trim_trailing_whitespace = false
================================================
FILE: .eslintrc.js
================================================
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
'cypress/globals': true,
},
extends: ['eslint:recommended', 'plugin:cypress/recommended'],
parser: 'babel-eslint',
plugins: ['cypress'],
rules: {
'accessor-pairs': 2,
'array-callback-return': 2,
'array-bracket-spacing': 2,
'arrow-body-style': 2,
'arrow-parens': [2, 'as-needed'],
'arrow-spacing': 2,
'block-scoped-var': 2,
'block-spacing': 2,
'brace-style': 2,
camelcase: [
2,
{
properties: 'always',
},
],
'capitalized-comments': [
2,
'always',
{
ignoreConsecutiveComments: true,
},
],
'class-methods-use-this': 2,
'comma-dangle': [1, 'always-multiline'],
'comma-spacing': 2,
'comma-style': 2,
'computed-property-spacing': 2,
'consistent-return': 2,
'consistent-this': 2,
curly: 2,
'default-case': 2,
'dot-location': [1, 'property'],
'dot-notation': 2,
'eol-last': 2,
eqeqeq: 2,
'func-call-spacing': 2,
'func-name-matching': 2,
'func-names': 2,
'global-require': 2,
'guard-for-in': 2,
'id-length': [
2,
{
min: 1,
max: 24,
},
],
indent: [
2,
2,
{
SwitchCase: 1,
VariableDeclarator: {
var: 2,
let: 2,
const: 3,
},
},
],
'key-spacing': 2,
'keyword-spacing': 2,
'linebreak-style': 2,
'lines-around-comment': [
2,
{
beforeBlockComment: true,
afterBlockComment: false,
allowBlockStart: true,
allowBlockEnd: true,
allowObjectStart: true,
allowObjectEnd: true,
allowArrayStart: true,
allowArrayEnd: true,
},
],
'lines-around-directive': 2,
'max-depth': 2,
'max-len': [
2,
{
code: 120,
},
],
'max-nested-callbacks': 2,
'max-statements-per-line': [
2,
{
max: 2,
},
],
'new-cap': 2,
'new-parens': 2,
'newline-before-return': 2,
'newline-per-chained-call': 2,
'no-alert': 2,
'no-array-constructor': 2,
'no-await-in-loop': 2,
'no-caller': 2,
'no-console': 0,
'no-continue': 0,
'no-div-regex': 2,
'no-duplicate-imports': 2,
'no-else-return': 2,
'no-empty-function': 2,
'no-eq-null': 2,
'no-eval': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-label': 2,
'no-extra-parens': [
2,
'all',
{
nestedBinaryExpressions: false,
},
],
'no-floating-decimal': 2,
'no-global-assign': 2,
'no-implicit-coercion': 2,
'no-implicit-globals': 2,
'no-implied-eval': 2,
'no-invalid-this': 2,
'no-iterator': 2,
'no-labels': 2,
'no-lone-blocks': 2,
'no-lonely-if': 2,
'no-loop-func': 2,
'no-magic-numbers': [
0,
{
ignore: [0, 1],
ignoreArrayIndexes: true,
},
],
'no-mixed-operators': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-assign': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [
2,
{
max: 3,
},
],
'no-negated-condition': 2,
'no-nested-ternary': 2,
'no-new-func': 2,
'no-new-object': 2,
'no-new-wrappers': 2,
'no-new': 2,
'no-octal-escape': 2,
'no-param-reassign': 2,
'no-plusplus': [
2,
{
allowForLoopAfterthoughts: true,
},
],
'no-proto': 2,
'no-prototype-builtins': 2,
'no-restricted-properties': 2,
'no-return-assign': 2,
'no-return-await': 2,
'no-script-url': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-tabs': 2,
'no-template-curly-in-string': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-unsafe-negation': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': 2,
'no-unused-expressions': [
2,
{
allowShortCircuit: true,
},
],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-concat': 2,
'no-useless-constructor': 2,
'no-useless-escape': 2,
'no-useless-rename': 2,
'no-useless-return': 2,
'no-var': 2,
'no-void': 2,
'no-warning-comments': 1,
'no-whitespace-before-property': 2,
'no-with': 2,
'object-shorthand': 2,
'object-property-newline': 0,
'operator-assignment': 2,
'operator-linebreak': 2,
'padded-blocks': [2, 'never'],
'padding-line-between-statements': [
2,
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
],
'prefer-arrow-callback': 2,
'prefer-const': 2,
'prefer-destructuring': 2,
'prefer-promise-reject-errors': 2,
'prefer-rest-params': 2,
'prefer-spread': 2,
'prefer-template': 2,
'quote-props': [2, 'consistent-as-needed'],
quotes: [2, 'single'],
radix: 2,
'require-await': 2,
'require-jsdoc': 2,
'rest-spread-spacing': 2,
semi: 2,
'semi-spacing': 2,
'space-before-blocks': 2,
'space-in-parens': 2,
'space-infix-ops': 2,
'space-unary-ops': [
2,
{
words: true,
nonwords: false,
},
],
'spaced-comment': 2,
strict: 2,
'symbol-description': 2,
'template-curly-spacing': 2,
'valid-jsdoc': 2,
'vars-on-top': 2,
'wrap-iife': 2,
'wrap-regex': 2,
yoda: 2,
},
};
================================================
FILE: .github/CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at team@barba.dev. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
================================================
FILE: .github/CONTRIBUTING.md
================================================
# Contributing
This project uses:
- [TypeScript](http://www.typescriptlang.org/)
- [Lerna](https://lerna.js.org/)
- [Commitizen](http://commitizen.github.io/cz-cli/)
- [EditorConfig](https://editorconfig.org/)
- [TSLint](https://palantir.github.io/tslint/)
- [Prettier](https://prettier.io/)
- [markdownlint](https://github.com/DavidAnson/markdownlint)
> Please, be sure to properly configure your editor…
## Install
Make sure you have `yarn` and `node >= 10.16.0`
- `git clone git@github.com:barbajs/barba.git`
- `cd barba`
- `yarn install`
## Testing
Run `yarn test`
For watching mode, run `yarn run watch`
> Do not pay attention to the few `console.error` logs…<br>
> In watch mode, you can select a specific package by pressing `l` > :arrow_down: > `space` > :leftwards_arrow_with_hook:
## Comitting
Run `yarn run commit` or install `commitizen` globally and run `cz`.
This project follows:
- [Conventional Commits](https://conventionalcommits.org) specification for commit "structure"
- [gitmoji](https://gitmoji.carloscuesta.me/) for commit messages
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: xavierfoucrier
================================================
FILE: .github/ISSUE_TEMPLATE/bug-report.yml
================================================
name: "🐛 Bug report"
description: "Report an issue with BarbaJS"
title: "..."
labels:
- bug
body:
- type: markdown
attributes:
value: |
By opening an issue, you consider that there is a problem with the library itself, rather than your code. If you are requesting for help, please **use the Slack workspace** in order to ask the whole community. Join using the invite link, read [the developer documentation](https://barba.js.org/docs/getstarted/useful-links/#Developer). Alternatively, I can provide a custom code support for you or your company through [sponsoring/quote](https://github.com/sponsors/xavierfoucrier) depending on the amount of work, don't hesitate to reach me by mail or private message on Slack ✌️🪴.
- type: input
attributes:
label: What version are you using?
description: Please provide the version of BarbaJS your are using in your project.
placeholder: e.g. v2.9.7
validations:
required: true
- type: dropdown
attributes:
label: What package are you using?
description: |
Please specify the package with which you are having a problem.
options:
- "@barba/core"
- "@barba/router"
- "@barba/prefetch"
- "@barba/css"
- "@barba/head"
- "@barba/preset"
validations:
required: true
- type: textarea
attributes:
label: Describe your issue
description: |
You can use Markdown in this field.
validations:
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
contact_links:
- name: ✨ Official BarbaJS website
url: https://barba.js.org/
about: New to BarbaJS? Have a look at the website before opening an issue.
- name: 💬 Slack workspace
url: https://join.slack.com/t/barbajs/shared_invite/enQtNTU3NTAyMjkxMzAyLTkxYWUwZmM1YWQxMmNlYmE0ZjY4NDQxMGUxYjkwYWFlMzEzOWM4OTRhMWRmYTQyYzFlMmQ3OGFmYmI3MWY0OWY
about: Want to discuss or chat with the community? Join using the invite link!
================================================
FILE: .github/stale.yml
================================================
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
================================================
FILE: .gitignore
================================================
# Created by https://www.gitignore.io/api/node,macos,linux,windows,visualstudiocode
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/node,macos,linux,windows,visualstudiocode
### Custom ###
.tmp
dist
report.html
.rts2*
# Keep microbundle's mangle.json out until it needs to be there?
mangle.json
/cypress/screenshots
/cypress/videos
/documentation/api
/PERSONAL.md
================================================
FILE: .lintstagedrc
================================================
{
"src/**/*.ts": ["prettier --write", "npm run lint"],
"*.{json,md}": ["prettier --write"]
}
================================================
FILE: .markdownlint.json
================================================
{
"default": true,
"fenced-code-language": false,
"first-line-h1": false,
"line-length": false,
"no-inline-html": false,
"no-trailing-punctuation": {
"punctuation": ",;:"
},
"ol-prefix": {
"style": "ordered"
},
"ul-indent": { "indent": 2 },
"ul-style": false
}
================================================
FILE: .vscode/settings.json
================================================
{
"editor.formatOnSave": true,
"sasslint.enable": false
}
================================================
FILE: AUTHORS
================================================
Luigi De Rosa <lurukee@gmail.com> (https://luruke.com/)
Thierry Michel <thmichel@gmail.com> (https://www.epic.net/)
Xavier Foucrier <xavier.foucrier@gmail.com> (https://xavierfoucrier.dev/)
================================================
FILE: CI.md
================================================
# CI
## @snitch
```
language: node_js
node_js:
- "8"
after_success: 'npm run coverage'
```
## sassy-beam
`.travis.yml`
```yml
language: node_js
cache:
directories:
- ~/.npm
notifications:
email: false
node_js:
- '10'
- '9'
- '8'
after_success:
- npm run travis-deploy-once "npm run semantic-release"
branches:
except:
- /^v\d+\.\d+\.\d+$/
```
`package.json`
```json
"release": {
"prepare": [
"@semantic-release/npm",
{
"path": "@semantic-release/exec",
"cmd": "npm run doc"
},
{
"path": "@semantic-release/git",
"assets": [
"docs"
],
"message": "docs(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
},
```
## [Lerna FAQ](https://github.com/lerna/lerna/blob/master/FAQ.md)
`circle.yml`
- https://circleci.com/blog/deploying-documentation-to-github-pages-with-continuous-integration/
- https://circleci.com/blog/publishing-npm-packages-using-circleci-2-0/
- https://circleci.com/blog/continuous-package-publishing-part-ii-automated-npm-publishing-with-circleci-and-packagecloud/
================================================
FILE: LICENSE.md
================================================
MIT License
Copyright (c) 2024 Luigi De Rosa, Thierry Michel, Xavier Foucrier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: NOTES.md
================================================
# Notes
## Lerna/npm publish
- `yarn run release`
- `yarn run release:next`
### Beta `publish`
```sh
yarn test
lerna publish --canary --preid next --dist-tag next
lerna publish --github-release --force-publish=*
lerna publish --github-release
```
To be tested: `--github-release`
### Test `publish` with [verdaccio](https://www.npmjs.com/package/verdaccio)
```sh
npm adduser --registry http://localhost:4873
lerna publish --registry http://localhost:4873 --canary --preid next
```
================================================
FILE: README.md
================================================
# barba.js –  [](https://circleci.com/gh/barbajs/barba/tree/main) [](https://coveralls.io/github/barbajs/barba?branch=main) [](http://commitizen.github.io/cz-cli/) [](https://conventionalcommits.org) [](https://lerna.js.org/) [](https://github.com/barbajs/barba/blob/main/LICENSE.md) [](#contributors) [](https://join.slack.com/t/barbajs/shared_invite/enQtNTU3NTAyMjkxMzAyLTkxYWUwZmM1YWQxMmNlYmE0ZjY4NDQxMGUxYjkwYWFlMzEzOWM4OTRhMWRmYTQyYzFlMmQ3OGFmYmI3MWY0OWY)
Create **badass, fluid and smooth transitions** between your website’s pages.
[](https://barba.js.org/)
## Intro
**Barba.js** — aka *Barba* — is a small *(7kb minified and compressed)* and easy-to-use library that helps you create fluid and smooth transitions between your website's pages. It makes your website run like a **SPA** *(Single Page Application)* and help reduce the delay between your pages, minimize browser HTTP requests and enhance your user's web experience.
## Features
Barba is user friendly, smart, extensible and futureproof. The library provides a bunch of **useful features that will make your website shine** like any other website, ever!
* Simplified API - *written in **TypeScript** and works with `Promises`*
* Cross-browser support - *[progressive enhancement](https://barba.js.org/docs/getstarted/browser-support/) for modern browsers*
* DOM flexibility - *custom [markup](https://barba.js.org/docs/getstarted/markup/#DOM-structure), [namespaces](https://barba.js.org/docs/getstarted/markup/#Namespace) and `data` attribute [schema](https://barba.js.org/docs/getstarted/markup/#Schema)*
* Hook system - *regulars lifecycle [methods](https://barba.js.org/docs/advanced/hooks/) for `Transitions` and `Views`*
* Transition resolution - *[rules](https://barba.js.org/docs/advanced/transitions/#Rules) that let Barba pick the right transition*
* Sync mode - *indicates whether leave and enter hooks should [“play together”](https://barba.js.org/docs/advanced/transitions/#Sync-mode)*
* Page related code - *[custom logic](https://barba.js.org/docs/advanced/views/) attached to a specific `View`*
* Modern browser strategies - *keep your site run [as fast as possible](https://barba.js.org/docs/advanced/strategies/)*
* Cook like an expert - *improve your [development workflow](https://barba.js.org/docs/advanced/recipes/)*
* Built-in utilities - *brought to you with a bunch of [useful methods](https://barba.js.org/docs/advanced/utils/)*
* Plugin system - *supplied with [useful plugins](https://barba.js.org/docs/plugins/intro/)*
* Wide community - *more than 980+ [amazing developers](https://barba.js.org/docs/getstarted/useful-links/#Developer) can help build your website!*
## Documentation
Here you will find the documentation describing **how to use** the library.
1. [Website](https://barba.js.org/) - official Barba website
2. [User guide](https://barba.js.org/docs/getstarted/intro/) - how to install and use the plugin
3. [Lessons, courses and videos](https://barba.js.org/docs/getstarted/useful-links/#Learn) - for in-depth learning
4. [Showcase](https://barba.js.org/showcase/) - selected works made with Barba
5. [Developer API](https://barba.js.org/api/) - by developers, for developers
> [!NOTE]
> This guide assumes intermediate knowledge of HTML, CSS, and JavaScript. It is worth mentioning that all code examples use ES6+ syntax. If you are not comfortable with this syntax, we would encourage you to grasp the basics then come back.
>
> In case of emergency, check the ["legacy" code example](https://barba.js.org/docs/getstarted/legacy/).
## Sponsor
If you like this library and want to give some recognition, it is now possible to **become a [Github sponsor](https://www.github.com/sponsors/xavierfoucrier)** and support this project by sponsoring BarbaJS maintainer on Github. Even if it's a small contribution, you participate in the effort of making **open source projects maintained for anyone**, and developers to be rewarded for their work/time.
## Contribute
If you want to report a bug or request a new feature/improvement, please **read the project [contributors guidelines](.github/CONTRIBUTING.md) before**.
Thanks for taking time to contribute to Barba :tada: :+1:
## Contributors
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://luruke.com"><img src="https://avatars0.githubusercontent.com/u/61326?v=4?s=100" width="100px;" alt="Luigi De Rosa"/><br /><sub><b>Luigi De Rosa</b></sub></a><br /><a href="#ideas-luruke" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/barbajs/barba/commits?author=luruke" title="Code">💻</a> <a href="https://github.com/barbajs/barba/commits?author=luruke" title="Documentation">📖</a> <a href="#question-luruke" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/issues?q=author%3Aluruke" title="Bug reports">🐛</a> <a href="https://github.com/barbajs/barba/commits?author=luruke" title="Tests">⚠️</a> <a href="https://github.com/barbajs/barba/pulls?q=is%3Apr+reviewed-by%3Aluruke" title="Reviewed Pull Requests">👀</a> <a href="#infra-luruke" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://thierrymichel.net"><img src="https://avatars2.githubusercontent.com/u/806883?v=4?s=100" width="100px;" alt="Thierry Michel"/><br /><sub><b>Thierry Michel</b></sub></a><br /><a href="#ideas-thierrymichel" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/barbajs/barba/commits?author=thierrymichel" title="Code">💻</a> <a href="https://github.com/barbajs/barba/commits?author=thierrymichel" title="Documentation">📖</a> <a href="#question-thierrymichel" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/issues?q=author%3Athierrymichel" title="Bug reports">🐛</a> <a href="https://github.com/barbajs/barba/commits?author=thierrymichel" title="Tests">⚠️</a> <a href="https://github.com/barbajs/barba/pulls?q=is%3Apr+reviewed-by%3Athierrymichel" title="Reviewed Pull Requests">👀</a> <a href="#infra-thierrymichel" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://xavierfoucrier.dev"><img src="https://avatars1.githubusercontent.com/u/2471223?v=4?s=100" width="100px;" alt="Xavier Foucrier"/><br /><sub><b>Xavier Foucrier</b></sub></a><br /><a href="#ideas-xavierfoucrier" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/barbajs/barba/commits?author=xavierfoucrier" title="Code">💻</a> <a href="https://github.com/barbajs/barba/commits?author=xavierfoucrier" title="Documentation">📖</a> <a href="#question-xavierfoucrier" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/commits?author=xavierfoucrier" title="Tests">⚠️</a> <a href="https://github.com/barbajs/barba/pulls?q=is%3Apr+reviewed-by%3Axavierfoucrier" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/barbajs/barba/issues?q=author%3Axavierfoucrier" title="Bug reports">🐛</a> <a href="#infra-xavierfoucrier" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.thenerodesign.com"><img src="https://avatars2.githubusercontent.com/u/858150?v=4?s=100" width="100px;" alt="Marco Grimaldi"/><br /><sub><b>Marco Grimaldi</b></sub></a><br /><a href="#design-markog85" title="Design">🎨</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://ihatetomatoes.net"><img src="https://avatars1.githubusercontent.com/u/735672?v=4?s=100" width="100px;" alt="Petr TIchy"/><br /><sub><b>Petr TIchy</b></sub></a><br /><a href="#blog-Ihatetomatoes" title="Blogposts">📝</a> <a href="#tutorial-Ihatetomatoes" title="Tutorials">✅</a> <a href="#video-Ihatetomatoes" title="Videos">📹</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://studio123.ca"><img src="https://avatars0.githubusercontent.com/u/22644154?v=4?s=100" width="100px;" alt="Cody Marcoux"/><br /><sub><b>Cody Marcoux</b></sub></a><br /><a href="#question-c0mrx" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://philiphussak.com"><img src="https://avatars1.githubusercontent.com/u/3285136?v=4?s=100" width="100px;" alt="Phil."/><br /><sub><b>Phil.</b></sub></a><br /><a href="#question-wiseoldman" title="Answering Questions">💬</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://www.fnool.com"><img src="https://avatars0.githubusercontent.com/u/5812801?v=4?s=100" width="100px;" alt="Giorgio Finulli"/><br /><sub><b>Giorgio Finulli</b></sub></a><br /><a href="#question-gfnool" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.thisisnota.studio"><img src="https://avatars2.githubusercontent.com/u/6507123?v=4?s=100" width="100px;" alt="Wouter"/><br /><sub><b>Wouter</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3AWouter125" title="Bug reports">🐛</a> <a href="#question-Wouter125" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://selfaware.studio"><img src="https://avatars2.githubusercontent.com/u/12376535?v=4?s=100" width="100px;" alt="Mike Wagz"/><br /><sub><b>Mike Wagz</b></sub></a><br /><a href="#ideas-mikehwagz" title="Ideas, Planning, & Feedback">🤔</a> <a href="#question-mikehwagz" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/commits?author=mikehwagz" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.youtube.com/c/redstapler_channel"><img src="https://avatars0.githubusercontent.com/u/16864380?v=4?s=100" width="100px;" alt="Red Stapler"/><br /><sub><b>Red Stapler</b></sub></a><br /><a href="#tutorial-theredstapler" title="Tutorials">✅</a> <a href="#video-theredstapler" title="Videos">📹</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.19h47.fr"><img src="https://avatars1.githubusercontent.com/u/11242861?v=4?s=100" width="100px;" alt="Jérémy Levron"/><br /><sub><b>Jérémy Levron</b></sub></a><br /><a href="#question-19h47" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://anhskohbo.github.io/"><img src="https://avatars2.githubusercontent.com/u/1529454?v=4?s=100" width="100px;" alt="Nguyen Van Anh"/><br /><sub><b>Nguyen Van Anh</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=anhskohbo" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.thedanielweber.com"><img src="https://avatars1.githubusercontent.com/u/668910?v=4?s=100" width="100px;" alt="Daniel Weber"/><br /><sub><b>Daniel Weber</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=dlwebdev" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://www.jmporchet.ch"><img src="https://avatars3.githubusercontent.com/u/3099008?v=4?s=100" width="100px;" alt="Jean-Marie Porchet"/><br /><sub><b>Jean-Marie Porchet</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=jmporchet" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.jamesdocherty.com/"><img src="https://avatars1.githubusercontent.com/u/325490?v=4?s=100" width="100px;" alt="James"/><br /><sub><b>James</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=docherty" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ruggeri.io"><img src="https://avatars0.githubusercontent.com/u/999162?v=4?s=100" width="100px;" alt="Nicholas"/><br /><sub><b>Nicholas</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=nicholasruggeri" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://patrick.wtf"><img src="https://avatars1.githubusercontent.com/u/667029?v=4?s=100" width="100px;" alt="Patrick Arminio"/><br /><sub><b>Patrick Arminio</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=patrick91" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://angelogulina.it"><img src="https://avatars0.githubusercontent.com/u/4223655?v=4?s=100" width="100px;" alt="A (from Sicily)"/><br /><sub><b>A (from Sicily)</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=angelogulina" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/pavel-mazhuga"><img src="https://avatars3.githubusercontent.com/u/29140681?v=4?s=100" width="100px;" alt="Pavel Mazhuga"/><br /><sub><b>Pavel Mazhuga</b></sub></a><br /><a href="#question-pavel-mazhuga" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://dmdcode.it"><img src="https://avatars0.githubusercontent.com/u/7113516?v=4?s=100" width="100px;" alt="Daniele De Matteo"/><br /><sub><b>Daniele De Matteo</b></sub></a><br /><a href="#question-DMDc0de" title="Answering Questions">💬</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/aswinkumar863"><img src="https://avatars0.githubusercontent.com/u/32381261?v=4?s=100" width="100px;" alt="aswinkumar863"/><br /><sub><b>aswinkumar863</b></sub></a><br /><a href="#question-aswinkumar863" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/BounceIncHQ"><img src="https://avatars0.githubusercontent.com/u/39249876?v=4?s=100" width="100px;" alt="BounceIncHQ"/><br /><sub><b>BounceIncHQ</b></sub></a><br /><a href="#question-BounceIncHQ" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/gordonwes"><img src="https://avatars3.githubusercontent.com/u/10758596?v=4?s=100" width="100px;" alt="gordonwes"/><br /><sub><b>gordonwes</b></sub></a><br /><a href="#question-gordonwes" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/evfleet"><img src="https://avatars2.githubusercontent.com/u/7504632?v=4?s=100" width="100px;" alt="Evan Fleet"/><br /><sub><b>Evan Fleet</b></sub></a><br /><a href="#question-evfleet" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/issues?q=author%3Aevfleet" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.aligator-kom.de"><img src="https://avatars2.githubusercontent.com/u/32126746?v=4?s=100" width="100px;" alt="Jörg"/><br /><sub><b>Jörg</b></sub></a><br /><a href="#example-jd4Aligator" title="Examples">💡</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.zaak.ch"><img src="https://avatars3.githubusercontent.com/u/12050808?v=4?s=100" width="100px;" alt="ZAAK"/><br /><sub><b>ZAAK</b></sub></a><br /><a href="#example-StudioZAAK" title="Examples">💡</a> <a href="#question-StudioZAAK" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://leap-in.com"><img src="https://avatars1.githubusercontent.com/u/42055102?v=4?s=100" width="100px;" alt="Masahiro Tonomura"/><br /><sub><b>Masahiro Tonomura</b></sub></a><br /><a href="#example-leapincorp" title="Examples">💡</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/CassiusHR"><img src="https://avatars1.githubusercontent.com/u/24419585?v=4?s=100" width="100px;" alt="CassiusHR"/><br /><sub><b>CassiusHR</b></sub></a><br /><a href="#question-CassiusHR" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.shanemurphy.me"><img src="https://avatars2.githubusercontent.com/u/3694619?v=4?s=100" width="100px;" alt="Shane Murphy"/><br /><sub><b>Shane Murphy</b></sub></a><br /><a href="#question-shanewmurphy" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.dylanreeves.com"><img src="https://avatars3.githubusercontent.com/u/1294637?v=4?s=100" width="100px;" alt="Dylan Reeves"/><br /><sub><b>Dylan Reeves</b></sub></a><br /><a href="#question-watzing" title="Answering Questions">💬</a> <a href="#example-watzing" title="Examples">💡</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.quentinneyraud.fr"><img src="https://avatars2.githubusercontent.com/u/9378568?v=4?s=100" width="100px;" alt="Quentin Neyraud"/><br /><sub><b>Quentin Neyraud</b></sub></a><br /><a href="#question-quentinneyraud" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tortilaman"><img src="https://avatars2.githubusercontent.com/u/5018268?v=4?s=100" width="100px;" alt="tortilaman"/><br /><sub><b>tortilaman</b></sub></a><br /><a href="#question-tortilaman" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/psntr"><img src="https://avatars2.githubusercontent.com/u/20617539?v=4?s=100" width="100px;" alt="psntr"/><br /><sub><b>psntr</b></sub></a><br /><a href="#question-psntr" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://thisbailiwick.com"><img src="https://avatars3.githubusercontent.com/u/12637253?v=4?s=100" width="100px;" alt="Kevin Clark"/><br /><sub><b>Kevin Clark</b></sub></a><br /><a href="#question-thisbailiwick" title="Answering Questions">💬</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://takodesign.one"><img src="https://avatars2.githubusercontent.com/u/26543624?v=4?s=100" width="100px;" alt="Tadeas Kosek"/><br /><sub><b>Tadeas Kosek</b></sub></a><br /><a href="#question-Tedowski" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/gustavo-a"><img src="https://avatars2.githubusercontent.com/u/26806307?v=4?s=100" width="100px;" alt="Gustavo de Andrade"/><br /><sub><b>Gustavo de Andrade</b></sub></a><br /><a href="#question-gustavo-a" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://durkangroup.com/"><img src="https://avatars0.githubusercontent.com/u/25391588?v=4?s=100" width="100px;" alt="Clinton"/><br /><sub><b>Clinton</b></sub></a><br /><a href="#question-crobbinsdg" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.spon.io"><img src="https://avatars3.githubusercontent.com/u/3268717?v=4?s=100" width="100px;" alt="Dave Stockley"/><br /><sub><b>Dave Stockley</b></sub></a><br /><a href="#question-magicspon" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://khaiknievel.carbonmade.com"><img src="https://avatars1.githubusercontent.com/u/5792500?v=4?s=100" width="100px;" alt="khaiknievel"/><br /><sub><b>khaiknievel</b></sub></a><br /><a href="#question-khaiknievel" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/issues?q=author%3Akhaiknievel" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.francescomichelini.com/"><img src="https://avatars3.githubusercontent.com/u/5191941?v=4?s=100" width="100px;" alt="Francesco Michelini"/><br /><sub><b>Francesco Michelini</b></sub></a><br /><a href="#question-kekkorider" title="Answering Questions">💬</a> <a href="#example-kekkorider" title="Examples">💡</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/FistMeNaruto"><img src="https://avatars1.githubusercontent.com/u/13431677?v=4?s=100" width="100px;" alt="Domantas Petrauskas"/><br /><sub><b>Domantas Petrauskas</b></sub></a><br /><a href="#question-FistMeNaruto" title="Answering Questions">💬</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://kylebrumm.com"><img src="https://avatars3.githubusercontent.com/u/1709677?v=4?s=100" width="100px;" alt="Kyle Brumm"/><br /><sub><b>Kyle Brumm</b></sub></a><br /><a href="#question-kjbrum" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/obelmont"><img src="https://avatars3.githubusercontent.com/u/6540497?v=4?s=100" width="100px;" alt="Oliver Belmont"/><br /><sub><b>Oliver Belmont</b></sub></a><br /><a href="#question-obelmont" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://lunelson.xyz/"><img src="https://avatars1.githubusercontent.com/u/1242864?v=4?s=100" width="100px;" alt="Lu Nelson"/><br /><sub><b>Lu Nelson</b></sub></a><br /><a href="#question-lunelson" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://bierdb.be"><img src="https://avatars1.githubusercontent.com/u/1107185?v=4?s=100" width="100px;" alt="Bram Cordie"/><br /><sub><b>Bram Cordie</b></sub></a><br /><a href="#question-bramcordie" title="Answering Questions">💬</a> <a href="#ideas-bramcordie" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://portfolio.schouman.info"><img src="https://avatars1.githubusercontent.com/u/510652?v=4?s=100" width="100px;" alt="Michael Schouman"/><br /><sub><b>Michael Schouman</b></sub></a><br /><a href="#question-metalmini" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.jumplink.eu"><img src="https://avatars2.githubusercontent.com/u/1073989?v=4?s=100" width="100px;" alt="Pascal Garber"/><br /><sub><b>Pascal Garber</b></sub></a><br /><a href="#question-JumpLink" title="Answering Questions">💬</a> <a href="#ideas-JumpLink" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/bfred_it"><img src="https://avatars3.githubusercontent.com/u/1402241?v=4?s=100" width="100px;" alt="Federico Brigante"/><br /><sub><b>Federico Brigante</b></sub></a><br /><a href="#question-bfred-it" title="Answering Questions">💬</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://coreylee.tokyo/"><img src="https://avatars1.githubusercontent.com/u/1465865?v=4?s=100" width="100px;" alt="Corey Lee"/><br /><sub><b>Corey Lee</b></sub></a><br /><a href="#question-factorzero" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.imls.uzh.ch/research/vonmering/people/milan-simonovic.html"><img src="https://avatars3.githubusercontent.com/u/888008?v=4?s=100" width="100px;" alt="Milan Simonovic"/><br /><sub><b>Milan Simonovic</b></sub></a><br /><a href="#question-mbsimonovic" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://djul.es"><img src="https://avatars1.githubusercontent.com/u/196644?v=4?s=100" width="100px;" alt="Julien Vasseur"/><br /><sub><b>Julien Vasseur</b></sub></a><br /><a href="#question-Djules" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/panwron"><img src="https://avatars2.githubusercontent.com/u/8494786?v=4?s=100" width="100px;" alt="Maciej Wrona"/><br /><sub><b>Maciej Wrona</b></sub></a><br /><a href="#question-panwron" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://terion.name"><img src="https://avatars0.githubusercontent.com/u/1060205?v=4?s=100" width="100px;" alt="Terion"/><br /><sub><b>Terion</b></sub></a><br /><a href="#ideas-terion-name" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/cartogram"><img src="https://avatars2.githubusercontent.com/u/462077?v=4?s=100" width="100px;" alt="Matt Seccafien"/><br /><sub><b>Matt Seccafien</b></sub></a><br /><a href="#ideas-cartogram" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.maxschulmeister.com"><img src="https://avatars2.githubusercontent.com/u/15388185?v=4?s=100" width="100px;" alt="Max Schulmeister"/><br /><sub><b>Max Schulmeister</b></sub></a><br /><a href="#ideas-max-schu" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://davidaase.com"><img src="https://avatars3.githubusercontent.com/u/1521451?v=4?s=100" width="100px;" alt="David"/><br /><sub><b>David</b></sub></a><br /><a href="#ideas-tipsy" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/pierrehenri220"><img src="https://avatars3.githubusercontent.com/u/19267400?v=4?s=100" width="100px;" alt="Pierre-Henri Lavigne"/><br /><sub><b>Pierre-Henri Lavigne</b></sub></a><br /><a href="#ideas-pierrehenri220" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lsbyerley"><img src="https://avatars0.githubusercontent.com/u/3066258?v=4?s=100" width="100px;" alt="lsbyerley"/><br /><sub><b>lsbyerley</b></sub></a><br /><a href="#ideas-lsbyerley" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://gmorisseau.com/"><img src="https://avatars2.githubusercontent.com/u/242203?v=4?s=100" width="100px;" alt="Guillaume M."/><br /><sub><b>Guillaume M.</b></sub></a><br /><a href="#ideas-theamnesic" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://oscarotero.com"><img src="https://avatars3.githubusercontent.com/u/377873?v=4?s=100" width="100px;" alt="Oscar Otero"/><br /><sub><b>Oscar Otero</b></sub></a><br /><a href="#ideas-oscarotero" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://twitter.com/nicooprat"><img src="https://avatars0.githubusercontent.com/u/645641?v=4?s=100" width="100px;" alt="Nico Prat"/><br /><sub><b>Nico Prat</b></sub></a><br /><a href="#ideas-nicooprat" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://marco.solazzi.me/"><img src="https://avatars2.githubusercontent.com/u/104721?v=4?s=100" width="100px;" alt="Marco Solazzi"/><br /><sub><b>Marco Solazzi</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3Adwightjack" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/atoupet-toki"><img src="https://avatars3.githubusercontent.com/u/38693082?v=4?s=100" width="100px;" alt="atoupet-toki"/><br /><sub><b>atoupet-toki</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3Aatoupet-toki" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/josias-r"><img src="https://avatars1.githubusercontent.com/u/11424820?v=4?s=100" width="100px;" alt="Josias"/><br /><sub><b>Josias</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3Ajosias-r" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/OksanaRomaniv"><img src="https://avatars1.githubusercontent.com/u/5724727?v=4?s=100" width="100px;" alt="Oksana Romaniv"/><br /><sub><b>Oksana Romaniv</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3AOksanaRomaniv" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.olivier-guilleux.com"><img src="https://avatars3.githubusercontent.com/u/5804006?v=4?s=100" width="100px;" alt="Olivier Guilleux"/><br /><sub><b>Olivier Guilleux</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3Aoguilleux" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://liroopierre.com"><img src="https://avatars3.githubusercontent.com/u/11197281?v=4?s=100" width="100px;" alt="Liroo Pierre ᵈᵉᵛ"/><br /><sub><b>Liroo Pierre ᵈᵉᵛ</b></sub></a><br /><a href="https://github.com/barbajs/barba/commits?author=Liroo" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lmartins"><img src="https://avatars2.githubusercontent.com/u/151981?v=4?s=100" width="100px;" alt="Luis Martins"/><br /><sub><b>Luis Martins</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3Almartins" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://arraytheband.com.au"><img src="https://avatars0.githubusercontent.com/u/41524?v=4?s=100" width="100px;" alt="Matthew"/><br /><sub><b>Matthew</b></sub></a><br /><a href="#ideas-matthewjumpsoffbuildings" title="Ideas, Planning, & Feedback">🤔</a> <a href="#question-matthewjumpsoffbuildings" title="Answering Questions">💬</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://slgoetz.com"><img src="https://avatars0.githubusercontent.com/u/393000?v=4?s=100" width="100px;" alt="Simon Goetz"/><br /><sub><b>Simon Goetz</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3ASlgoetz" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://luis.pt"><img src="https://avatars3.githubusercontent.com/u/14956453?v=4?s=100" width="100px;" alt="Luís Carvalho"/><br /><sub><b>Luís Carvalho</b></sub></a><br /><a href="#question-luis-pt" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mrsamse"><img src="https://avatars2.githubusercontent.com/u/20925205?v=4?s=100" width="100px;" alt="Samuel Berisha"/><br /><sub><b>Samuel Berisha</b></sub></a><br /><a href="#question-mrsamse" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andersonleite"><img src="https://avatars.githubusercontent.com/u/52427?v=4?s=100" width="100px;" alt="Anderson Leite"/><br /><sub><b>Anderson Leite</b></sub></a><br /><a href="#question-andersonleite" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/issues?q=author%3Aandersonleite" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://jaycollett.co/"><img src="https://avatars.githubusercontent.com/u/13233809?v=4?s=100" width="100px;" alt="Jay Collett"/><br /><sub><b>Jay Collett</b></sub></a><br /><a href="#question-JayBox325" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/issues?q=author%3AJayBox325" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/timgates42"><img src="https://avatars.githubusercontent.com/u/47873678?v=4?s=100" width="100px;" alt="Tim Gates"/><br /><sub><b>Tim Gates</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3Atimgates42" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.nicolascusan.com/"><img src="https://avatars.githubusercontent.com/u/1353931?v=4?s=100" width="100px;" alt="Nicolas Cusan"/><br /><sub><b>Nicolas Cusan</b></sub></a><br /><a href="#question-nicolas-cusan" title="Answering Questions">💬</a> <a href="https://github.com/barbajs/barba/issues?q=author%3Anicolas-cusan" title="Bug reports">🐛</a> <a href="https://github.com/barbajs/barba/commits?author=nicolas-cusan" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://geraldnako.com/"><img src="https://avatars.githubusercontent.com/u/5095859?v=4?s=100" width="100px;" alt="Gerald Nako"/><br /><sub><b>Gerald Nako</b></sub></a><br /><a href="https://github.com/barbajs/barba/issues?q=author%3Ageraldnako" title="Bug reports">🐛</a> <a href="https://github.com/barbajs/barba/commits?author=geraldnako" title="Code">💻</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
## License
The project is developed under the **MIT** license:
- **Permissions**: This software and derivatives may be used for commercial purposes, you may distribute this software, this software may be modified and you may use and modify the software without distributing it.
- **Conditions**: Include a copy of the license and copyright notice with the code.
- **Limitations**: Software is provided without warranty and the software author/license owner cannot be held liable for damages.
Read the [full license](LICENSE.md) for more information about your rights.
================================================
FILE: TODO.md
================================================
# Todos
- [x][m] Router : allow leading slash ?
- [x][m] Reload current page
- [x][m] Prevent `xlink:href` on link enter (eg: SVG)
- [x][s] No transitions ? weird behavior…
- [ ][w] BS, how to fix it (definitely)
- [ ][m] (npm)ignore .DS_Store files
---
- [ ] @barba/
- [ ] **transitions** (basic, ready-to-use. e.g.: fade, slide, …)
- [ ] **css** (add CSS classes via hooks)
- [ ] **loader** ??? (programatically fetch and cache pages - also see [quicklink](https://github.com/GoogleChromeLabs/quicklink))
- [ ] Tests:
- [ ] unit tests
- [ ] e2e tests (puppetteer? / cypress?)
- [ ] Documentation
- [ ] Manual (instructions, examples, …)
- [ ] Auto generated from code
- [ ] Builds / releases
- [ ] auto-update version(s)
- [ ] auto-update changelogs
- [ ] auto-update file gzip size (website and readme)
- [ ] CI (tests, coverage on push, PR, …)
- [ ] Force git commit to follow a certain schema
- [ ] License (find correct open source license)
- > Luigi said: anyone can do what they want, but:
>
> - they can't resell it as it is
> - I have the right in any moment to not allow a specific use
- NB: This seems conflicting with open source core principles
Following are the most "restrictive" :)
- [GNU AGPLv3](https://choosealicense.com/licenses/agpl-3.0/)
- [Open Software License 3.0](https://choosealicense.com/licenses/osl-3.0/)
- [European Union Public License 1.2](https://choosealicense.com/licenses/eupl-1.2/)
- [ ] Community
- [x] Github issue template
- [x] Forum / chat -> [Slack](https://barbajs.slack.com)
- [ ] Other
- [ ] Make jest work with `babel.config.js` (global + optional local merge)
- https://github.com/babel/babel/issues/7208
- https://github.com/facebook/jest/issues/6053#issuecomment-383632515
- https://babeljs.io/docs/en/options
- https://babeljs.io/docs/en/config-files
- ```
@barba/core: import barba from '../src';
@barba/core: ^^^^^
@barba/core: SyntaxError: Unexpected identifier
@barba/core: at ScriptTransformer._transformAndBuildScript (../../node_modules/jest-runtime/build/script_transformer.js:403:17)
@barba/core: babel.config.js:root
@barba/core: .babelrc.js:core
```
- [ ] Repo transfer?
- [doc](https://help.github.com/articles/transferring-a-repository/)
- [hack post](https://francisco.io/blog/transferring-github-stars/)
- VSCode extensions recommendations? settings?
================================================
FILE: commitlint.config.js
================================================
module.exports = {
extends: ['ccgls'],
};
================================================
FILE: cypress/fixtures/example.json
================================================
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
================================================
FILE: cypress/plugins/index.js
================================================
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/* eslint-disable consistent-return, no-unused-vars */
module.exports = (on, config) => {
// https://github.com/cypress-io/cypress/issues/1872#issuecomment-450807452
on('before:browser:launch', (browser = {}, args) => {
if (browser.name === 'chrome') {
// ^ make sure this is your browser name, you may
// be using 'canary' or 'chromium' for example, so change it to match!
args.push('--proxy-bypass-list=<-loopback>');
return args;
}
});
};
/* eslint-enable consistent-return, no-unused-vars */
================================================
FILE: cypress/support/commands.js
================================================
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
// Automatically prepend "root path" depending on package
// TODO: it breaks "run all"
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
const r = /^packages\/([a-z]*)\/(__e2e__)\/.*\.spec.js$/;
const root = Cypress.spec.relative.replace(r, '$1/__web__');
originalFn(root + url, options);
});
Cypress.Commands.add('prepare', (url, title, namespace) => {
// 1. Go to home
cy.visit(url);
// 2. Should have wrapper and container
cy.get('[data-barba=wrapper]')
.as('wrapper')
.should('exist');
cy.get('[data-barba=container]').should('exist');
// 3. Titles have correct content
cy.title().should('contain', title);
cy.get('[data-test=title]')
.as('h1') // Alias to @h1
.should('contain', title);
// 4. Aliases current container
cy.get('[data-test-container=current]').as('current');
// 4. Check namespace if provided
if (namespace) {
cy.get('@current').should('have.attr', 'data-barba-namespace', namespace);
}
});
Cypress.Commands.add('final', (url, title, namespace) => {
// 0. Wrapper is the same
cy.get('@wrapper').should('have.attr', 'data-test-wrapper', 'current');
// 1. URL has changed
cy.url().should('include', url);
// 2. H1 has changed
cy.get('@h1').should('contain', title);
// 3. Page title has changed
cy.title().should('contain', title);
// 4. Current container has been removed
cy.get('@current').should('not.exist');
// 5. Next container exists
cy.get('[data-test-container=next]')
.as('next')
.should('exist');
// 6. Check namespace if provided
if (namespace) {
cy.get('@next').should('have.attr', 'data-barba-namespace', namespace);
}
});
================================================
FILE: cypress/support/e2e.js
================================================
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')
================================================
FILE: cypress.config.ts
================================================
import { defineConfig } from 'cypress'
export default defineConfig({
fixturesFolder: './cypress/fixtures',
screenshotsFolder: './cypress/screenshots',
videosFolder: './cypress/videos',
projectId: 'ngfcig',
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:8111/packages/',
specPattern: './packages/**/__e2e__/**/*.spec.js',
},
})
================================================
FILE: documentation/theme/assets/css/override.css
================================================
.tsd-signature-symbol {
hyphens: auto;
}
/* Hack: hide layout instructions */
.tsd-panel > hr:first-child,
.tsd-panel > hr + p,
.tsd-panel > hr + p + hr {
display: none;
}
blockquote {
border-left: 4px solid #e0e2e5;
margin-left: 0;
padding-left: 20px;
color: #69737d;
}
================================================
FILE: documentation/theme/layouts/default.hbs
================================================
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{#ifCond model.name '==' project.name}}{{project.name}}{{else}}{{model.name}} | {{project.name}}{{/ifCond}}
</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{relativeURL "assets/css/main.css"}}">
<link rel="stylesheet" href="{{relativeURL "assets/css/override.css"}}">
</head>
<body>
{{> header}}
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
{{{contents}}}
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
{{#each navigation.children}}
{{> navigation}}
{{/each}}
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
{{#each toc.children}}
{{> toc.root}}
{{/each}}
</ul>
</nav>
</div>
</div>
</div>
{{> footer}}
<div class="overlay"></div>
<script src="{{relativeURL "assets/js/main.js"}}"></script>
<script>if (location.protocol == 'file:') document.write('<script src="{{relativeURL "assets/js/search.js"}}"><' + '/script>');</script>
{{> analytics}}
</body>
</html>
================================================
FILE: jest.config.js
================================================
module.exports = {
collectCoverageFrom: [
'packages/**/src/**/*.ts',
'!packages/**/src/**/*.d.ts',
'!packages/**/src/typings.ts',
'!packages/**/src/**/index.ts',
'!packages/**/src/polyfills/**.ts',
'!packages/core/src/utils/helpers.ts',
],
coverageThreshold: {
global: {
statements: 95,
branches: 95,
functions: 95,
lines: 95,
},
},
preset: 'ts-jest',
resetMocks: true,
testEnvironment: 'jest-environment-jsdom-global',
testMatch: ['**/__tests__/**/*.test.ts'],
transformIgnorePatterns: ['<rootDir>.*(node_modules)(?!.*@barba.*).*$'],
verbose: true,
watchPlugins: ['jest-watch-lerna-packages'],
};
================================================
FILE: lerna.json
================================================
{
"command": {
"publish": {
"conventionalCommits": true,
"message": "chore(release): 🔖 publish",
"npmClient": "npm"
},
"version": {
"allowBranch": "main"
}
},
"npmClient": "yarn",
"packages": [
"packages/*"
],
"version": "independent",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
================================================
FILE: package.json
================================================
{
"name": "root",
"private": true,
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@commitlint/config-lerna-scopes": "^19.0.0",
"@types/jest": "24.9.1",
"@types/lodash": "^4.17.7",
"all-contributors-cli": "^6.26.1",
"babel-eslint": "^10.1.0",
"commitizen": "^4.3.0",
"commitlint-config-ccgls": "1.4.8",
"coveralls": "^3.1.1",
"cypress": "^13.13.2",
"cz-ccgls": "^0.4.6",
"eslint": "^8.57.0",
"eslint-plugin-cypress": "^2.15.2",
"gzip-size": "^7.0.0",
"http-server": "14.1.1",
"husky": "^9.1.4",
"jest": "26.3.0",
"jest-environment-jsdom-global": "^4.0.0",
"jest-watch-lerna-packages": "^1.1.0",
"lerna": "^8.1.7",
"lint-staged": "15.2.7",
"lodash": "^4.17.11",
"microbundle": "0.15.1",
"npm-run-all": "4.1.5",
"prettier": "^3.3.3",
"rimraf": "6.0.1",
"source-map-explorer": "2.5.3",
"start-server-and-test": "^1.15.5",
"ts-jest": "26.3.0",
"tslint": "^6.1.3",
"typedoc": "0.15.8",
"typedoc-plugin-external-module-name": "^4.0.6",
"typedoc-plugin-sourcefile-url": "^1.0.6",
"typescript": "^4.9.5",
"typescript-tslint-plugin": "1.0.2",
"wait-for-expect": "3.0.2",
"xhr-mock": "^2.4.1"
},
"license": "MIT",
"workspaces": [
"packages/*"
],
"types": "typings",
"scripts": {
"prepare": "husky",
"build": "lerna run build",
"build:watch": "lerna run build:watch --parallel",
"clean": "rimraf docs && lerna clean",
"clear": "lerna run clear",
"commit": "npx git-cz || exit 0",
"commit-retry": "npx git-cz --retry || exit 0",
"coverage": "cat ./coverage/lcov.info | coveralls",
"doc": "typedoc packages/*/src --tsconfig typedoc.json --sourcefile-url-prefix 'https://github.com/barbajs/barba/tree/main/'",
"lint": "tslint packages/*/src/** packages/*/__tests__/**",
"ls": "lerna ls",
"prepublish": "yarn run build",
"release": "lerna publish && npm run tag:next",
"release:next": "lerna publish --dist-tag next",
"report": "lerna run report",
"size": "lerna run size",
"tag:latest": "lerna run tag:latest --npm-client=npm",
"tag:next": "lerna run tag:next --npm-client=npm",
"test": "npm-run-all lint build unit e2e",
"unit": "yarn jest --coverage",
"unit:ci": "yarn jest --coverage --maxWorkers=2",
"unit:watch": "yarn jest --watch --verbose false",
"e2e": "start-server-and-test cy:server :8111 cy:run",
"e2e:watch": "start-server-and-test cy:server :8111 cy:dev",
"cy:server": "http-server . -p 8111",
"cy:run": "cypress run --browser chrome --record --key 6f43f378-ecdc-4502-9635-b6f5c205429e",
"cy:dev": "cypress open",
"watch": "npm-run-all -p build:watch unit:watch"
},
"husky": {
"hooks": {
"pre-commit": "lerna run --concurrency 1 --stream precommit",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"config": {
"commitizen": {
"path": "./node_modules/cz-ccgls"
}
}
}
================================================
FILE: packages/core/.npmignore
================================================
### Custom ###
/__e2e__
/__mocks__
/__tests__
/__web__
/jest.config.js
/mangle.json
/*.md
/.rts2*
!/README.md
!/CHANGELOG.md
================================================
FILE: packages/core/AUTHORS
================================================
Luigi De Rosa <lurukee@gmail.com> (https://luruke.com/)
Thierry Michel <thmichel@gmail.com> (https://www.epic.net/)
Xavier Foucrier <xavier.foucrier@gmail.com> (https://xavierfoucrier.dev/)
================================================
FILE: packages/core/CHANGELOG.md
================================================
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.10.3](https://github.com/barbajs/barba/compare/@barba/core@2.10.2...@barba/core@2.10.3) (2024-08-12)
### Bug Fixes
- **core:** :ambulance: hotfix event propagation ([6d35aa4](https://github.com/barbajs/barba/commit/6d35aa431673e6d37161772483f891d611fef8eb)), closes [#746](https://github.com/barbajs/barba/issues/746)
## [2.10.2](https://github.com/barbajs/barba/compare/@barba/core@2.10.0...@barba/core@2.10.2) (2024-08-02)
### Bug Fixes
- **core:** :bug: fix popstate when no link event is present ([680e2e7](https://github.com/barbajs/barba/commit/680e2e73c0a77186ae22112f1cefa2deef9eea04))
# [2.10.0](https://github.com/barbajs/barba/compare/@barba/core@2.9.7...@barba/core@2.10.0) (2024-05-10)
### Bug Fixes
- **core:** :bug: cache first page ([a45bc26](https://github.com/barbajs/barba/commit/a45bc2692802cbb36259604e11ad8cd680e4701f)), closes [#602](https://github.com/barbajs/barba/issues/602)
- **core:** :bug: fix `data-barba-history="replace"` attribute ([8e38a8f](https://github.com/barbajs/barba/commit/8e38a8f9097f68e92a1a18f42cf88edf1456d637))
- **core:** :bug: fix container replacement in the dom ([aec3143](https://github.com/barbajs/barba/commit/aec314365942c53497a05b857f7170e9bb0b0a44)), closes [#479](https://github.com/barbajs/barba/issues/479)
- **core:** :bug: fix DOMParser error on SSR ([cadba05](https://github.com/barbajs/barba/commit/cadba0512eb5459e325f7af82f210a92e05e24d5)), closes [#512](https://github.com/barbajs/barba/issues/512)
- **core:** :bug: fix request header name case ([167988d](https://github.com/barbajs/barba/commit/167988ddc67654675816ca39d8d28980c423d229))
- **core:** :bug: prevent `onLinkEnter` prefetch to cache relative URLs ([a7d15ac](https://github.com/barbajs/barba/commit/a7d15acb11f745107a4c11b5d783988a9eca7764))
- **core:** :bug: prevent assistive technology to read out the entire page ([4baef3e](https://github.com/barbajs/barba/commit/4baef3e8171c0e5b3dd98b8ca886e5ff811a7513)), closes [#681](https://github.com/barbajs/barba/issues/681)
- **core:** :bug: prevent programmatic prefetch to cache relative URLs ([a021236](https://github.com/barbajs/barba/commit/a021236668082a14d3c3c718acbc30ae0f5e9bdb))
- **core:** :bug: properly match `self` transition ([f7bd01c](https://github.com/barbajs/barba/commit/f7bd01cfdb333c1d0afad109a7f74d01adcb78f1))
- **core:** :bug: properly prevent `self` transition ([4c97b59](https://github.com/barbajs/barba/commit/4c97b59c86bc9e5ce9309621334d44849916299c)), closes [#700](https://github.com/barbajs/barba/issues/700)
- **core:** :pencil2: fix `this.barba` typo ([707c3de](https://github.com/barbajs/barba/commit/707c3de77152dad11e98cb10877a57965e561623))
- **core:** :pencil2: fix typos in tests ([a748356](https://github.com/barbajs/barba/commit/a748356daf77117a120783eee4750c16e7603ad2))
- **core:** :rotating_light: align asterisks for jsdoc ([ff837db](https://github.com/barbajs/barba/commit/ff837dbd2569d051164fd6f72cbad2919361cf84))
- **core:** :rotating_light: fix linter issues inside `core` ([5ae1432](https://github.com/barbajs/barba/commit/5ae1432d34a142154dc4a3928b7ab01a81ff232e))
- **core:** :rotating_light: fix maxlength line issue ([45df0d6](https://github.com/barbajs/barba/commit/45df0d696f69c2cfbeca6f764d1e5ae465b8d177))
- **core:** :rotating_light: sort imports alphabetically ([0ccbfda](https://github.com/barbajs/barba/commit/0ccbfdaf5c1a51c60240e4328b062ea8b63e3626))
- **core:** :rotating_light: sort variables alphabetically ([6c2c3d7](https://github.com/barbajs/barba/commit/6c2c3d70b6f63bb796a95d4778919707f63054a7))
- **core:** :white_check_mark: fix duplicate expect state ([085794b](https://github.com/barbajs/barba/commit/085794bac6fd32c2082c05c9d59c9135c0320b7f))
- **core:** :white_check_mark: fix request tests ([151abff](https://github.com/barbajs/barba/commit/151abff58dc8658ef251a96c3fb32db865322f6f))
- **core:** ✅ fix request tests ([79e207b](https://github.com/barbajs/barba/commit/79e207b4e7ff88c39a33f963d3833cfb9c2ba50b))
- **core:** 🐛 fix transition with popstate event and query string ([e27736f](https://github.com/barbajs/barba/commit/e27736fc305d0315cbf0a01f74a9209c8337a02e)), closes [#587](https://github.com/barbajs/barba/issues/587)
- **core:** 🚨 align asterisks for jsdoc ([811b3ab](https://github.com/barbajs/barba/commit/811b3ab0ea67933348228792b39240df01e3fe12))
- **core:** timeout reload, go to next page instead ([2b8f59a](https://github.com/barbajs/barba/commit/2b8f59a11a1440c4dc9c89126c511fbec4f4bffd))
### Features
- **core:** :sparkles: add `cacheFirstPage` option ([4306972](https://github.com/barbajs/barba/commit/43069722744822853dbc459aea5ab5a4b8bd924f))
- **core:** :sparkles: add `CacheStatus` to reflect Promise status ([61c28c7](https://github.com/barbajs/barba/commit/61c28c75fff686d19b03da3198776be293399e1b))
- **core:** :sparkles: add `CacheTarget` type ([a4e9045](https://github.com/barbajs/barba/commit/a4e9045a7ad14cf40dae7bf3084cd8e9a9e89cd7))
- **core:** :sparkles: add `getTarget` method ([1d187de](https://github.com/barbajs/barba/commit/1d187de72e11b2360b1e1f6c9f19a38d3fd94e97))
- **core:** :sparkles: add `Headers` module ([141249d](https://github.com/barbajs/barba/commit/141249d3764e5791530e265793ec72722d67958d))
- **core:** :sparkles: add `IDomSibling` interface ([d3acdb8](https://github.com/barbajs/barba/commit/d3acdb8dec3a494b5a17643312f778921155d22e))
- **core:** :sparkles: add `IResponse` interface ([c2fa15a](https://github.com/barbajs/barba/commit/c2fa15acfe3d7c8b08659dd0da5d6b409e9609ad))
- **core:** :sparkles: add a method to retrieve absolute href from URL ([ad96797](https://github.com/barbajs/barba/commit/ad967972a41a324dd9128855225f41bae6142587))
- **core:** :sparkles: allow `CacheStatus` to be retrieved ([9970f21](https://github.com/barbajs/barba/commit/9970f216c4e629783a7f2a4f828bf8ca707fc70c))
- **core:** :sparkles: allow custom `data` when adding to history ([2eaab1c](https://github.com/barbajs/barba/commit/2eaab1cf345462692951b9b09418484823e55bbb))
- **core:** :sparkles: allow custom data in `barba.history` ([920880a](https://github.com/barbajs/barba/commit/920880a8573ee9fc1eb03fd75cce08c872be0d27)), closes [#630](https://github.com/barbajs/barba/issues/630)
- **core:** :sparkles: allow programmatic `barba.history` management ([e1e4b5f](https://github.com/barbajs/barba/commit/e1e4b5f270cd9e08aa4981a89bb744a8834f41c1)), closes [#601](https://github.com/barbajs/barba/issues/601)
- **core:** :sparkles: expose `getQuery` and `getHash` methods ([4456f4b](https://github.com/barbajs/barba/commit/4456f4b7d03cd9933a0ea43dd722298be82b9088))
- **core:** :sparkles: implement `getSibling` method ([4bf2802](https://github.com/barbajs/barba/commit/4bf280265f21e4e5b6a628982d4155be0a6467a9))
- **core:** :sparkles: pass the trigger event through `hooks` ([a2fef11](https://github.com/barbajs/barba/commit/a2fef11e7947667ff6386bd1e4ef680c30aaadeb)), closes [#622](https://github.com/barbajs/barba/issues/622)
- **core:** :sparkles: properly manage server response ([ae94e2c](https://github.com/barbajs/barba/commit/ae94e2c929e20ef527f7c91fb2d006da7ae78a19))
- **core:** :sparkles: resolve `CacheRequest` with `IResponse` instead ([1061245](https://github.com/barbajs/barba/commit/106124553200a6f8c30fe8bdc562c12d38e56b2f))
- **core:** :sparkles: store `target` in the cache based on server response ([f321926](https://github.com/barbajs/barba/commit/f3219262bd161075d7478be39b60c4a5d3ae59b2))
- **core:** :sparkles: store response url through `IResponse` interface ([1963609](https://github.com/barbajs/barba/commit/19636096af3128d9ebbf73e7d845a593f13000e2))
- **core:** :sparkles: update cache `status` to reflect Promise state ([54edab1](https://github.com/barbajs/barba/commit/54edab19834f9e65024f18651c0634ca32f08e0b))
- **core:** ♻️ add headers type definitions ([5d2f13f](https://github.com/barbajs/barba/commit/5d2f13f098aed2a407dd664a66300c49c62362c2))
- **core:** ♻️ import `Headers` module ([1b6c418](https://github.com/barbajs/barba/commit/1b6c4181030c1e956fa43708f166f57315d6788d))
- **core:** ♻️ pass headers to the `request` utility ([60fa820](https://github.com/barbajs/barba/commit/60fa8204ca75c3a925c36d7e8f2c44a550b9c075))
- **core:** ✨ set custom request headers ([0edbffe](https://github.com/barbajs/barba/commit/0edbffea5d540ed35f1f85094d758c280a6e4d8d))
## [2.9.7](https://github.com/barbajs/barba/compare/@barba/core@2.9.6...@barba/core@2.9.7) (2020-01-16)
### Bug Fixes
- **core:** :bug: fix once only transition resolved for page ([0e52e61](https://github.com/barbajs/barba/commit/0e52e616e9964ad98f28239b1341a71cf1d29f4a)), closes [#483](https://github.com/barbajs/barba/issues/483)
## [2.9.6](https://github.com/barbajs/barba/compare/@barba/core@2.9.5...@barba/core@2.9.6) (2019-12-12)
### Bug Fixes
- **core:** :bug: fix route (object) resolution ([1fb344f](https://github.com/barbajs/barba/commit/1fb344f9f07fbe58c5893b09f59d471704c0c521))
## [2.9.5](https://github.com/barbajs/barba/compare/@barba/core@2.9.4...@barba/core@2.9.5) (2019-12-09)
### Bug Fixes
- **core:** :bug: filter transition errors from request errors ([281c85f](https://github.com/barbajs/barba/commit/281c85fc7bbaf3d51ee58653468c48b2404152ea)), closes [#475](https://github.com/barbajs/barba/issues/475)
## [2.9.4](https://github.com/barbajs/barba/compare/@barba/core@2.9.3...@barba/core@2.9.4) (2019-12-09)
### Bug Fixes
- **core:** :bug: fix cache management with ignore option ([d801813](https://github.com/barbajs/barba/commit/d801813976a130d41b3261e7de8f0bcdf5dcd581)), closes [#470](https://github.com/barbajs/barba/issues/470)
## [2.9.3](https://github.com/barbajs/barba/compare/@barba/core@2.9.2...@barba/core@2.9.3) (2019-12-09)
### Bug Fixes
- **core:** :recycle: refactor history states ([08c83b8](https://github.com/barbajs/barba/commit/08c83b857d8ab3f7826631968afaabf76e1a2e87)), closes [#473](https://github.com/barbajs/barba/issues/473) [#472](https://github.com/barbajs/barba/issues/472)
## [2.9.2](https://github.com/barbajs/barba/compare/@barba/core@2.9.1...@barba/core@2.9.2) (2019-11-25)
### Bug Fixes
- **root:** :art: improve typings for TS ([48f0637](https://github.com/barbajs/barba/commit/48f0637))
## [2.9.1](https://github.com/barbajs/barba/compare/@barba/core@2.9.0...@barba/core@2.9.1) (2019-11-25)
### Bug Fixes
- **core:** :rotating_light: fix TS errors, improve TS defs ([a48acd2](https://github.com/barbajs/barba/commit/a48acd2)), closes [#468](https://github.com/barbajs/barba/issues/468)
# [2.9.0](https://github.com/barbajs/barba/compare/@barba/core@2.8.0...@barba/core@2.9.0) (2019-11-25)
### Bug Fixes
- **core:** :bug: hooks: context can not be undefined ([f6bb536](https://github.com/barbajs/barba/commit/f6bb536)), closes [#468](https://github.com/barbajs/barba/issues/468)
### Features
- **core:** :sparkles: add replace history via data-attribute ([272a43f](https://github.com/barbajs/barba/commit/272a43f)), closes [#460](https://github.com/barbajs/barba/issues/460)
# [2.8.0](https://github.com/barbajs/barba/compare/@barba/core@2.7.2...@barba/core@2.8.0) (2019-11-06)
### Bug Fixes
- **core:** :bug: compare ports for sameUrl prevent check ([e2a84e4](https://github.com/barbajs/barba/commit/e2a84e4)), closes [#463](https://github.com/barbajs/barba/issues/463)
- **core:** :bug: popstate with unknown state (null) ([3369633](https://github.com/barbajs/barba/commit/3369633)), closes [#456](https://github.com/barbajs/barba/issues/456) [#466](https://github.com/barbajs/barba/issues/466)
- **core:** :ok_hand: resolve once transitions ([20cafe1](https://github.com/barbajs/barba/commit/20cafe1)), closes [#439](https://github.com/barbajs/barba/issues/439)
### Features
- **core:** :loud_sound: add/improve error logs ([e67a17b](https://github.com/barbajs/barba/commit/e67a17b)), closes [#447](https://github.com/barbajs/barba/issues/447)
## [2.7.2](https://github.com/barbajs/barba/compare/@barba/core@2.7.1...@barba/core@2.7.2) (2019-11-05)
### Bug Fixes
- **core:** :heavy_minus_sign: remove 'path' for URL resolution ([3875d0c](https://github.com/barbajs/barba/commit/3875d0c)), closes [#465](https://github.com/barbajs/barba/issues/465)
- **root:** :bug: fix context for views and add to transitions ([9054673](https://github.com/barbajs/barba/commit/9054673)), closes [#467](https://github.com/barbajs/barba/issues/467)
## [2.7.1](https://github.com/barbajs/barba/compare/@barba/core@2.7.0...@barba/core@2.7.1) (2019-10-27)
**Note:** Version bump only for package @barba/core
# [2.7.0](https://github.com/barbajs/barba/compare/@barba/core@2.6.1...@barba/core@2.7.0) (2019-10-27)
### Bug Fixes
- **core:** :bug: fix container + dom sibling insertion ([7f349a7](https://github.com/barbajs/barba/commit/7f349a7)), closes [#449](https://github.com/barbajs/barba/issues/449)
- **core:** :ok_hand: move after hooks ([42742ea](https://github.com/barbajs/barba/commit/42742ea)), closes [#455](https://github.com/barbajs/barba/issues/455)
### Features
- **core:** :sparkles: add preventRunning option ([93f0b50](https://github.com/barbajs/barba/commit/93f0b50)), closes [#414](https://github.com/barbajs/barba/issues/414)
## [2.6.1](https://github.com/barbajs/barba/compare/@barba/core@2.6.0...@barba/core@2.6.1) (2019-10-22)
### Bug Fixes
- **core:** :ambulance: fix URL with query/hash ([f5e639c](https://github.com/barbajs/barba/commit/f5e639c)), closes [#445](https://github.com/barbajs/barba/issues/445)
- **core:** :recycle: improve url/href/path management ([159afdc](https://github.com/barbajs/barba/commit/159afdc))
# [2.6.0](https://github.com/barbajs/barba/compare/@barba/core@2.5.1...@barba/core@2.6.0) (2019-08-22)
### Features
- **core:** :alembic: store scroll position in history ([0fb28e2](https://github.com/barbajs/barba/commit/0fb28e2))
## [2.5.1](https://github.com/barbajs/barba/compare/@barba/core@2.5.0...@barba/core@2.5.1) (2019-08-22)
### Bug Fixes
- **core:** :bug: keep container position ([5482154](https://github.com/barbajs/barba/commit/5482154))
# [2.5.0](https://github.com/barbajs/barba/compare/@barba/core@2.4.0...@barba/core@2.5.0) (2019-08-22)
### Features
- **core:** :ok_hand: replace popstate with back/forward ([c665052](https://github.com/barbajs/barba/commit/c665052))
# [2.4.0](https://github.com/barbajs/barba/compare/@barba/core@2.3.16...@barba/core@2.4.0) (2019-08-02)
### Features
- **core:** :sparkles: add history size ([3b8d7fd](https://github.com/barbajs/barba/commit/3b8d7fd))
## [2.3.16](https://github.com/barbajs/barba/compare/@barba/core@2.3.15...@barba/core@2.3.16) (2019-08-01)
### Bug Fixes
- **core:** :bug: Fix global hooks (before|afterEnter) on first load ([e948166](https://github.com/barbajs/barba/commit/e948166)), closes [#393](https://github.com/barbajs/barba/issues/393)
## [2.3.15](https://github.com/barbajs/barba/compare/@barba/core@2.3.14...@barba/core@2.3.15) (2019-07-17)
### Bug Fixes
- **core:** :ok_hand: view hook on page load ([c631b54](https://github.com/barbajs/barba/commit/c631b54)), closes [#393](https://github.com/barbajs/barba/issues/393)
## [2.3.14](https://github.com/barbajs/barba/compare/@barba/core@2.3.13...@barba/core@2.3.14) (2019-07-16)
### Bug Fixes
- **root:** :mute: remove print version ([be5aa73](https://github.com/barbajs/barba/commit/be5aa73)), closes [#415](https://github.com/barbajs/barba/issues/415)
## [2.3.13](https://github.com/barbajs/barba/compare/@barba/core@2.3.12...@barba/core@2.3.13) (2019-07-16)
### Bug Fixes
- **core:** :bug: Clean url extend ([7667a8d](https://github.com/barbajs/barba/commit/7667a8d))
- **core:** :bug: fix link with no href attribute ([e434ecb](https://github.com/barbajs/barba/commit/e434ecb))
## [2.3.12](https://github.com/barbajs/barba/compare/@barba/core@2.3.11...@barba/core@2.3.12) (2019-06-26)
### Bug Fixes
- **core:** :ok_hand: improve support of SVG links ([19e7e5d](https://github.com/barbajs/barba/commit/19e7e5d))
## [2.3.11](https://github.com/barbajs/barba/compare/@barba/core@2.3.10...@barba/core@2.3.11) (2019-06-25)
### Bug Fixes
- **core:** :bug: make page hook async ([10e66d9](https://github.com/barbajs/barba/commit/10e66d9))
## [2.3.10](https://github.com/barbajs/barba/compare/@barba/core@2.3.9...@barba/core@2.3.10) (2019-06-11)
### Bug Fixes
- **core:** :bug: remove "force repaint" when new container is added ([5a34322](https://github.com/barbajs/barba/commit/5a34322))
- **core:** :construction: fix "glitch" when new container added ([1286bf9](https://github.com/barbajs/barba/commit/1286bf9))
## [2.3.9](https://github.com/barbajs/barba/compare/@barba/core@2.3.8...@barba/core@2.3.9) (2019-04-29)
**Note:** Version bump only for package @barba/core
## [2.3.8](https://github.com/barbajs/barba/compare/@barba/core@2.3.7...@barba/core@2.3.8) (2019-04-29)
### Bug Fixes
- **core:** :bug: fix sameUrl with query params ([fa79a6a](https://github.com/barbajs/barba/commit/fa79a6a)), closes [#389](https://github.com/barbajs/barba/issues/389)
## [2.3.7](https://github.com/barbajs/barba/compare/@barba/core@2.3.6...@barba/core@2.3.7) (2019-04-29)
### Bug Fixes
- **core:** :bug: fix glitch on containers add/remove ([374660c](https://github.com/barbajs/barba/commit/374660c))
## [2.3.6](https://github.com/barbajs/barba/compare/@barba/core@2.3.5...@barba/core@2.3.6) (2019-04-29)
**Note:** Version bump only for package @barba/core
## [2.3.5](https://github.com/barbajs/barba/compare/@barba/core@2.3.4...@barba/core@2.3.5) (2019-04-29)
### Bug Fixes
- **core:** :construction: fix history ([36d3393](https://github.com/barbajs/barba/commit/36d3393))
## [2.3.4](https://github.com/barbajs/barba/compare/@barba/core@2.3.3...@barba/core@2.3.4) (2019-04-29)
### Bug Fixes
- **core:** :bug: fix object rule with no value ([4014fd8](https://github.com/barbajs/barba/commit/4014fd8))
## [2.3.3](https://github.com/barbajs/barba/compare/@barba/core@2.3.2...@barba/core@2.3.3) (2019-04-23)
### Bug Fixes
- **core:** :bug: update title with "next" ([f8c1940](https://github.com/barbajs/barba/commit/f8c1940)), closes [#384](https://github.com/barbajs/barba/issues/384)
## [2.3.2](https://github.com/barbajs/barba/compare/@barba/core@2.3.1...@barba/core@2.3.2) (2019-04-20)
### Bug Fixes
- **core:** :bug: remove current container at the end ([f6fab91](https://github.com/barbajs/barba/commit/f6fab91))
## [2.3.1](https://github.com/barbajs/barba/compare/@barba/core@2.3.0...@barba/core@2.3.1) (2019-04-16)
### Bug Fixes
- **core:** :bug: do not cache rendered HTML ([0cc4b86](https://github.com/barbajs/barba/commit/0cc4b86)), closes [#383](https://github.com/barbajs/barba/issues/383)
# [2.3.0](https://github.com/barbajs/barba/compare/@barba/core@2.2.0...@barba/core@2.3.0) (2019-04-14)
### Features
- **core:** :sparkles: add programmatically prefetch ([7b95ffd](https://github.com/barbajs/barba/commit/7b95ffd))
# [2.2.0](https://github.com/barbajs/barba/compare/@barba/core@2.1.3...@barba/core@2.2.0) (2019-04-14)
### Features
- **core:** :art: allow global hooks to be asynchronous ([be5dccf](https://github.com/barbajs/barba/commit/be5dccf))
## [2.1.3](https://github.com/barbajs/barba/compare/@barba/core@2.1.2...@barba/core@2.1.3) (2019-04-13)
### Bug Fixes
- **core:** :loud_sound: print version ([24dd2ea](https://github.com/barbajs/barba/commit/24dd2ea))
### Reverts
- **root:** :bug: revert failed release ([2b8a1ef](https://github.com/barbajs/barba/commit/2b8a1ef))
## [2.1.3](https://github.com/barbajs/barba/compare/@barba/core@2.1.2...@barba/core@2.1.3) (2019-04-13)
### Bug Fixes
- **core:** :loud_sound: print version ([24dd2ea](https://github.com/barbajs/barba/commit/24dd2ea))
## [2.1.2](https://github.com/barbajs/barba/compare/@barba/core@2.1.1...@barba/core@2.1.2) (2019-04-13)
### Bug Fixes
- **core:** :mute: remove debug logs ([f4ce952](https://github.com/barbajs/barba/commit/f4ce952))
## [2.1.1](https://github.com/barbajs/barba/compare/@barba/core@2.1.0...@barba/core@2.1.1) (2019-04-13)
### Bug Fixes
- **core:** :bug: fix cache not working ([a01e122](https://github.com/barbajs/barba/commit/a01e122))
- **core:** :bug: fix hook order ([716b062](https://github.com/barbajs/barba/commit/716b062))
- **core:** :bug: fix hooks order in sync mode true ([b3c92d1](https://github.com/barbajs/barba/commit/b3c92d1))
- **core:** :bug: fix popstate navigation ([f78ee11](https://github.com/barbajs/barba/commit/f78ee11)), closes [#359](https://github.com/barbajs/barba/issues/359)
- **core:** :bug: fix sameUrl + anchors ([039f5d9](https://github.com/barbajs/barba/commit/039f5d9)), closes [#359](https://github.com/barbajs/barba/issues/359)
- **core:** :bug: fix timeout error ([70b7805](https://github.com/barbajs/barba/commit/70b7805)), closes [#373](https://github.com/barbajs/barba/issues/373)
- **core:** :bug: fix view.beforeEnter on barba ready ([5a09470](https://github.com/barbajs/barba/commit/5a09470)), closes [#360](https://github.com/barbajs/barba/issues/360)
- **core:** :bug: fix wrong combo namespace / view hooks ([3c775a3](https://github.com/barbajs/barba/commit/3c775a3)), closes [#351](https://github.com/barbajs/barba/issues/351)
- **core:** :checkered_flag: fix InvalidStateError on IE ([b9eece9](https://github.com/barbajs/barba/commit/b9eece9)), closes [#371](https://github.com/barbajs/barba/issues/371)
- **core:** :green_apple: fix img[srcset] parsing ([8afe945](https://github.com/barbajs/barba/commit/8afe945)), closes [#362](https://github.com/barbajs/barba/issues/362)
- **core:** :ok_hand: add Accept header ([94962ef](https://github.com/barbajs/barba/commit/94962ef))
- **core:** :ok_hand: fix `beforeEnter` view hook ([0d11e44](https://github.com/barbajs/barba/commit/0d11e44))
- **core:** :ok_hand: make main transition hooks public ([2c0cc28](https://github.com/barbajs/barba/commit/2c0cc28))
- **core:** :ok_hand: make onRequestError public ([61193ad](https://github.com/barbajs/barba/commit/61193ad))
# 2.1.0 (2019-03-17)
### Bug Fixes
- **core:** :bug: append next container correctly on sync mode ([dc62bd3](https://github.com/barbajs/barba/commit/dc62bd3)), closes [#4](https://github.com/barbajs/barba/issues/4)
- **core:** :bug: fix `xlink:href` with SVG ([19ecd81](https://github.com/barbajs/barba/commit/19ecd81)), closes [#1](https://github.com/barbajs/barba/issues/1)
- **css:** :bug: fix css with next tick ([63642bf](https://github.com/barbajs/barba/commit/63642bf))
- **prefetch:** :bug: fix requestError ([33c213b](https://github.com/barbajs/barba/commit/33c213b))
- **root:** :bug: force publish ([ddb8798](https://github.com/barbajs/barba/commit/ddb8798))
- **root:** :ok_hand: replace error with warning when no transition ([661801e](https://github.com/barbajs/barba/commit/661801e))
- :bug: fix case issues ([c6adcb3](https://github.com/barbajs/barba/commit/c6adcb3))
### Features
- **core:** :sparkles: add prevent custom + update README ([2fb4ec6](https://github.com/barbajs/barba/commit/2fb4ec6))
- **css:** :recycle: add transitionend logic + big refactoring ([b775358](https://github.com/barbajs/barba/commit/b775358))
- **css:** :tada: initial commit ([aed8206](https://github.com/barbajs/barba/commit/aed8206))
- **root:** :sparkles: add logger + fixes ([6db3875](https://github.com/barbajs/barba/commit/6db3875))
- **router:** :sparkles: add multiple properties to `route` ([4e92c83](https://github.com/barbajs/barba/commit/4e92c83))
================================================
FILE: packages/core/LICENSE
================================================
MIT License
Copyright (c) 2024 Luigi De Rosa, Thierry Michel, Xavier Foucrier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: packages/core/README.md
================================================
# @barba/core
[](https://www.npmjs.com/package/@barba/core)
[](https://github.com/barbajs/barba/network/dependencies)
> TBD ([GitHub repo](https://github.com/barbajs/barba.js))
## Install
Using npm:
```sh
npm install --save-dev @barba/core
```
or using yarn:
```sh
yarn add @barba/core --dev
```
================================================
FILE: packages/core/__e2e__/container.spec.js
================================================
/* eslint-disable cypress/no-unnecessary-waiting */
describe('Transition', () => {
it('adds container at the right place', () => {
cy.prepare('/container.html', 'container', 'container');
cy.get('[data-test=sibling]').as('sibling');
cy.get('[data-test=link]').click();
cy.final('/page.html', 'page', 'page');
cy.get('@wrapper')
.children()
.eq(1)
.should('have.attr', 'data-test-container', 'next');
cy.get('@wrapper')
.children()
.eq(2)
.should('have.attr', 'data-test', 'sibling');
});
it('adds container at the right place [sync]', () => {
cy.prepare('/container.html', 'container', 'container');
cy.get('[data-test=sibling]').as('sibling');
cy.get('[data-test="link.sync"]').click();
cy.final('/page.html', 'page', 'page');
cy.get('@wrapper')
.children()
.eq(1)
.should('have.attr', 'data-test-container', 'next');
cy.get('@wrapper')
.children()
.eq(2)
.should('have.attr', 'data-test', 'sibling');
});
});
================================================
FILE: packages/core/__e2e__/default.spec.js
================================================
/* eslint-disable cypress/no-unnecessary-waiting */
describe('Transition', () => {
it('works', () => {
cy.prepare('/index.html', 'home', 'home');
cy.wait(1000); // Wait for once complete
// Click link
cy.get('[data-test=link]').click();
cy.final('/page.html', 'page', 'page');
});
});
================================================
FILE: packages/core/__e2e__/hooks.spec.js
================================================
/* eslint-disable no-mixed-operators, cypress/no-unnecessary-waiting */
const onceHooks = [
'global:beforeEnter',
// 'global:before',
// 'before',
'global:beforeOnce',
'beforeOnce',
'global:once',
'once',
'global:afterOnce',
'afterOnce',
// 'global:after',
// 'after',
'global:afterEnter',
];
const hooksDefault = [
...onceHooks,
'global:before',
'before',
'global:beforeLeave',
'beforeLeave',
'global:leave',
'leave',
'global:afterLeave',
'afterLeave',
'global:beforeEnter',
'beforeEnter',
'global:enter',
'enter',
'global:afterEnter',
'afterEnter',
'global:after',
'after',
];
const hooksSync = [
...onceHooks,
'global:before',
'before',
'global:beforeLeave',
'beforeLeave',
'global:beforeEnter',
'beforeEnter',
'global:leave',
'global:enter',
'leave',
'enter',
'global:afterLeave',
'afterLeave',
'global:afterEnter',
'afterEnter',
'global:after',
'after',
];
beforeEach(() => {
cy.prepare('/index.html', 'home', 'home');
cy.get('[data-test="hooks-list"]').as('hooks'); // Alias to @hooks
});
afterEach(() => {
cy.final('/page.html', 'page', 'page');
});
describe('Hooks', () => {
it('have default order', () => {
cy.wait(1000); // Wait for once complete
// Click link
cy.get('[data-test="link.hooks"]').click();
// Checks…
hooksDefault.forEach((name, i) => {
cy.get('@hooks')
.find(`:nth-child(${i + 1})`)
.should('contain', name);
});
});
it('have sync order', () => {
cy.wait(1000); // Wait for once complete
// Click link
cy.get('[data-test="link.hooks-sync"]').click();
// Checks…
hooksSync.forEach((name, i) => {
cy.get('@hooks')
.find(`:nth-child(${i + 1})`)
.should('contain', name);
});
});
});
================================================
FILE: packages/core/__e2e__/href.spec.js
================================================
/* eslint-disable cypress/no-unnecessary-waiting */
describe('Transition', () => {
const origin = 'http://localhost:8111';
const prefix = 'packages/core/__web__';
const page = 'page.html';
const query = '?query=string';
const hash = '#hash';
it('default URL', () => {
cy.prepare('/href.html', 'href', 'href');
cy.get('[data-test=link]').click();
cy.location().should(loc => {
expect(loc.href).to.eq(`${origin}/${prefix}/${page}`);
expect(loc.toString()).to.eq(`${origin}/${prefix}/${page}`);
expect(loc.pathname).to.eq(`/${prefix}/${page}`);
});
cy.final('/page.html', 'page', 'page');
});
it('query string URL', () => {
cy.prepare('/href.html', 'href', 'href');
cy.get('[data-test=query]').click();
cy.location().should(loc => {
expect(loc.href).to.eq(`${origin}/${prefix}/${page}${query}`);
expect(loc.toString()).to.eq(`${origin}/${prefix}/${page}${query}`);
expect(loc.pathname).to.eq(`/${prefix}/${page}`);
expect(loc.search).to.eq(query);
});
cy.final('/page.html', 'page', 'page');
});
it('hash URL', () => {
cy.prepare('/href.html', 'href', 'href');
cy.get('[data-test=hash]').click();
cy.location().should(loc => {
expect(loc.href).to.eq(`${origin}/${prefix}/${page}${hash}`);
expect(loc.toString()).to.eq(`${origin}/${prefix}/${page}${hash}`);
expect(loc.pathname).to.eq(`/${prefix}/${page}`);
expect(loc.hash).to.eq(hash);
});
cy.final('/page.html', 'page', 'page');
});
it('hash + query URL', () => {
cy.prepare('/href.html', 'href', 'href');
cy.get('[data-test=complex]').click();
cy.location().should(loc => {
expect(loc.href).to.eq(`${origin}/${prefix}/${page}${query}${hash}`);
expect(loc.toString()).to.eq(
`${origin}/${prefix}/${page}${query}${hash}`
);
expect(loc.pathname).to.eq(`/${prefix}/${page}`);
expect(loc.search).to.eq(query);
expect(loc.hash).to.eq(hash);
});
cy.final('/page.html', 'page', 'page');
});
});
================================================
FILE: packages/core/__e2e__/views.spec.js
================================================
/* eslint-disable no-mixed-operators, cypress/no-unnecessary-waiting */
const loadHooks = ['beforeEnter', 'afterEnter'];
const transitionHooks = [
'beforeLeave',
'afterLeave',
'beforeEnter',
'afterEnter',
];
beforeEach(() => {
cy.prepare('/views.html', 'home', 'home');
cy.get('[data-test="hooks-list"]').as('hooks'); // Alias to @hooks
});
afterEach(() => {
cy.final('/page.html', 'page', 'page');
});
describe('Views hooks', () => {
it('have default order', () => {
cy.wait(1000); // Wait for once complete
// Checks…
loadHooks.forEach((name, i) => {
cy.get('@hooks')
.find(`:nth-child(${i + 1})`)
.should('contain', name);
});
// Click link
cy.get('[data-test="link.hooks"]').click();
// Checks…
transitionHooks.forEach((name, i) => {
const j = i + loadHooks.length;
cy.get('@hooks')
.find(`:nth-child(${j + 1})`)
.should('contain', name);
});
});
// it('have sync order', () => {
// cy.wait(1000); // Wait for once complete
// // Click link
// cy.get('[data-test="link.hooks-sync"]').click();
// // Checks…
// hooksSync.forEach((name, i) => {
// cy.get('@hooks')
// .find(`:nth-child(${i + 1})`)
// .should('contain', name);
// });
// });
});
================================================
FILE: packages/core/__mocks__/barba.ts
================================================
import barba from '../src';
import { ITransitionPage } from '../src/defs';
/**
* Init barba with basic DOM for testing
*/
export function init(transitions: ITransitionPage[] = []): any {
const wrapper = document.createElement('div');
const container = document.createElement('div');
const link = document.createElement('a');
const span = document.createElement('span');
const namespace = 'current';
const mouseover = document.createEvent('HTMLEvents');
const click = document.createEvent('HTMLEvents');
wrapper.dataset.barba = 'wrapper';
container.dataset.barba = 'container';
container.dataset.barbaNamespace = namespace;
document.title = 'Current page';
document.body.appendChild(wrapper);
wrapper.appendChild(container);
container.appendChild(link);
link.appendChild(span);
mouseover.initEvent('mouseover', true, false);
click.initEvent('click', true, false);
barba.init({ transitions });
return { wrapper, container, link, span, mouseover, click };
}
================================================
FILE: packages/core/__mocks__/transitions.ts
================================================
import { ITransitionPage } from '../src/defs';
const namespace = 'n';
const route = 'r';
const custom = () => true;
const unamed: ITransitionPage[] = [
/* 0000 */ {}, // Nothing
/* 0010 */ { namespace }, // Namespace
/* 0011 */ { from: { namespace } },
/* 0012 */ { to: { namespace } },
/* 0013 */ { from: { namespace }, to: { namespace } },
/* 0100 */ { route }, // Route
/* 0101 */ { from: { route } },
/* 0102 */ { to: { route } },
/* 0103 */ { from: { route }, to: { route } },
/* 0110 */ { route, namespace }, // Route + namespace
/* 0111 */ { from: { route, namespace } }, // 10
/* 0112 */ { to: { route, namespace } },
/* 0113 */ { from: { route, namespace }, to: { route, namespace } },
/* 1000 */ { custom }, // Custom
/* 1001 */ { from: { custom } },
/* 1002 */ { to: { custom } },
/* 1003 */ { from: { custom }, to: { custom } }, // 16
/* 1010 */ { custom, namespace }, // Custom + namespace
/* 1011 */ { from: { custom, namespace } },
/* 1012 */ { to: { custom, namespace } },
/* 1013 */ { from: { custom, namespace }, to: { custom, namespace } },
/* 1100 */ { custom, route }, // Custom + route
/* 1101 */ { from: { custom, route } },
/* 1102 */ { to: { custom, route } },
/* 1103 */ { from: { custom, route }, to: { custom, route } },
/* 1110 */ { custom, route, namespace }, // Custom + route + namespace
/* 1111 */ { from: { custom, route, namespace } },
/* 1112 */ { to: { custom, route, namespace } },
/* 1113 */ {
from: { custom, route, namespace },
to: { custom, route, namespace },
},
];
const named: ITransitionPage[] = unamed.map((t, i) => {
t.name = i.toString();
return t;
});
export default named;
================================================
FILE: packages/core/__tests__/core/core.click.test.ts
================================================
import { init } from '../../__mocks__/barba';
import barba from '../../src';
const { link, span, click } = init();
// Mocks
barba.page = jest.fn();
afterEach(() => {
(global as any).jsdom.reconfigure({ url: 'http://localhost/' });
});
it('handle link click', () => {
link.href = 'foo';
span.dispatchEvent(click);
expect(barba.page).toHaveBeenCalledTimes(1);
});
it('handle link click with same url', () => {
link.href = 'http://localhost/';
span.dispatchEvent(click);
expect(barba.page).toHaveBeenCalledTimes(0);
});
it('handle link click with prevent', () => {
link.href = 'foo';
link.dataset.barbaPrevent = '';
span.dispatchEvent(click);
expect(barba.page).toHaveBeenCalledTimes(0);
});
it('handle link click with transition running', () => {
barba.go = jest.fn();
barba.transitions.isRunning = true;
link.href = 'foo';
delete link.dataset.barbaPrevent;
barba.preventRunning = false;
span.dispatchEvent(click);
barba.preventRunning = true;
span.dispatchEvent(click);
expect(barba.go).toHaveBeenCalledTimes(1);
});
================================================
FILE: packages/core/__tests__/core/core.enter.test.ts
================================================
import waitForExpect from 'wait-for-expect';
import xhrMock from 'xhr-mock';
import { init } from '../../__mocks__/barba';
import barba from '../../src';
import { IUrlFull } from '../../src/defs';
import { parse } from '../../src/utils/url';
const { link, span, mouseover } = init();
const sameUrl = 'http://localhost/';
const sameHtml = `<html>
<head>
<title>Current page</title>
</head>
<body>
<div data-barba="wrapper">
<div data-barba="container" data-barba-namespace="current"></div>
</div>
</body>
</html>`;
// Mocks
let spyHas: jest.SpyInstance;
let spySet: jest.SpyInstance;
beforeEach(() => {
spyHas = jest.spyOn(barba.cache, 'has');
spySet = jest.spyOn(barba.cache, 'set');
xhrMock.setup();
xhrMock.error(() => {}); // tslint:disable-line:no-empty
});
afterEach(() => {
link.removeAttribute('data-barba-prevent');
spyHas.mockRestore();
spySet.mockRestore();
xhrMock.teardown();
});
it('handle link enter', () => {
link.href = 'foo';
span.dispatchEvent(mouseover);
expect(spyHas).toHaveBeenCalledTimes(1);
expect(spySet).toHaveBeenCalledTimes(1);
});
it('handle link enter with same url', () => {
barba.cache.set(sameUrl, Promise.resolve({
html: sameHtml,
url: {
href: sameUrl,
...parse(sameUrl)
} as IUrlFull,
}), 'init', 'pending');
spySet.mockRestore();
link.href = sameUrl;
span.dispatchEvent(mouseover);
expect(spyHas).toHaveBeenCalledTimes(1);
expect(spySet).toHaveBeenCalledTimes(0);
});
it('handle bad request', async () => {
barba.logger.error = jest.fn();
xhrMock.get('http://localhost/bad', (req, res) => res.status(500));
xhrMock.error(() => {}); // tslint:disable-line:no-empty
link.href = 'bad';
span.dispatchEvent(mouseover);
expect(spyHas).toHaveBeenCalledTimes(1);
expect(spySet).toHaveBeenCalledTimes(1);
await waitForExpect(() => {
expect(barba.logger.error).toHaveBeenCalledTimes(1);
});
});
it('handle link enter with prevent link', () => {
link.href = 'foo';
link.dataset.barbaPrevent = '';
span.dispatchEvent(mouseover);
expect(spyHas).toHaveBeenCalledTimes(0);
expect(spySet).toHaveBeenCalledTimes(0);
});
it('handle link enter with prevent url', () => {
barba.destroy();
barba.init({ prefetchIgnore: '/foo' });
spyHas = jest.spyOn(barba.cache, 'has');
spySet = jest.spyOn(barba.cache, 'set');
link.href = '/foo';
span.dispatchEvent(mouseover);
expect(spyHas).toHaveBeenCalledTimes(0);
expect(spySet).toHaveBeenCalledTimes(0);
});
================================================
FILE: packages/core/__tests__/core/core.force.test.ts
================================================
import barba from '../../src';
it('force url change', () => {
Object.defineProperty(window, 'location', {
writable: true,
value: { assign: jest.fn() }
})
const url = 'http://localhost/foo.html';
barba.force(url);
expect(window.location.assign).toHaveBeenCalledTimes(1);
});
================================================
FILE: packages/core/__tests__/core/core.go.test.ts
================================================
/* tslint:disable:no-empty no-string-literal */
import { init } from '../../__mocks__/barba';
import barba from '../../src';
import { hooks } from '../../src/hooks';
import { schemaAttribute } from '../../src/schemas/attribute';
// Needed for "request" module
(global as any).Headers = class {};
const namespace = 'next';
const nextUrl = 'http://localhost/foo';
// Mocks
let spyHistory: jest.SpyInstance;
beforeEach(() => {
init();
// barba.init();
self.fetch = jest.fn().mockImplementation(() => ({
status: 200,
text: () =>
Promise.resolve(`<html>
<body>
<div data-barba="wrapper">
<div data-barba="container" data-barba-namespace="${namespace}"></div>
</div>
</body>
</html>`),
}));
});
afterEach(() => {
barba.destroy();
spyHistory && spyHistory.mockRestore();
(global as any).jsdom.reconfigure({ url: 'http://localhost/' });
});
it('do go', async () => {
barba.page = jest.fn();
await barba.go('http://localhost/foo');
expect(barba.page).toHaveBeenCalledWith(
'http://localhost/foo',
'barba',
undefined,
false
);
});
it('force when manager running', async () => {
barba.force = jest.fn();
barba.page = jest.fn();
hooks.do = jest.fn();
barba.transitions.store.add('transition', { leave() {}, enter() {} });
barba.transitions['_running'] = true;
await barba.go(nextUrl, 'barba');
expect(barba.force).toHaveBeenCalledTimes(1);
expect(hooks.do).not.toHaveBeenCalled();
expect(barba.page).not.toHaveBeenCalled();
barba.transitions['_running'] = false;
});
it('prevent same url with no self transition', async () => {
barba.page = jest.fn();
await barba.go('http://localhost/');
expect(barba.page).not.toHaveBeenCalled();
});
it('use self transition on same url [barba]', async () => {
barba.page = jest.fn();
barba.transitions.store.add('transition', { name: 'self' });
await barba.go('http://localhost/');
expect(barba.page).toHaveBeenCalledWith(
'http://localhost/',
'barba',
undefined,
true
);
});
it('use self transition on same url [popstate]', async () => {
barba.page = jest.fn();
barba.transitions.store.add('transition', { name: 'self' });
const event = {
state: {
index: 0,
},
stopPropagation() {},
preventDefault() {},
} as PopStateEvent;
await barba.go('http://localhost/', 'popstate', event);
expect(barba.page).toHaveBeenCalledWith(
'http://localhost/',
'popstate',
event,
true
);
});
it('add history', async () => {
spyHistory = jest.spyOn(barba.history, 'add');
await barba.go('http://localhost/foo');
expect(barba.history.add).toHaveBeenCalledWith(
'http://localhost/foo',
'barba'
);
});
it('change history', async () => {
spyHistory = jest.spyOn(barba.history, 'change');
await barba.prefetch('http://localhost/');
await barba.go('http://localhost/foo', 'barba');
await barba.go('http://localhost/', 'barba');
expect(barba.history.change).toHaveBeenCalledTimes(2);
});
it('manage direction', async () => {
barba.page = jest.fn();
const event = {
state: {
index: 1,
},
stopPropagation() {},
preventDefault() {},
} as PopStateEvent;
await barba.go('http://localhost/foo');
await barba.go('http://localhost/bar');
await barba.go('http://localhost/foo', 'popstate', event);
expect(barba.page).toHaveBeenCalledWith(
'http://localhost/foo',
'back',
event,
false
);
});
================================================
FILE: packages/core/__tests__/core/core.init.test.ts
================================================
/* tslint:disable:no-string-literal */
import barba from '../../src';
import { PreventCheck } from '../../src/defs';
const wrapper = document.createElement('div');
const container = document.createElement('div');
const namespace = 'ns';
wrapper.dataset.barba = 'wrapper';
container.dataset.barba = 'container';
container.dataset.barbaNamespace = namespace;
/**
* Mock init
*/
function init() {
barba.init();
}
beforeEach(() => {
document.body.appendChild(wrapper);
wrapper.appendChild(container);
});
afterEach(() => {
document.body.innerHTML = '';
});
it('needs barba wrapper', () => {
wrapper.remove();
expect(init).toThrow('No Barba wrapper found');
});
it('needs barba container', () => {
container.remove();
expect(init).toThrow('No Barba container found');
});
it('needs valid prevent custom', () => {
const start = () => {
barba.init({ prevent: ('bad' as unknown) as PreventCheck });
};
expect(start).toThrow('Prevent should be a function');
barba.prevent.add = jest.fn();
expect(barba.prevent.add).not.toHaveBeenCalled();
});
it('adds prevent custom', () => {
barba.init({ prevent: () => true });
expect(barba.prevent.tests.has('preventCustom')).toBeTruthy();
});
it('has DOM elements', () => {
barba.init();
expect(barba.wrapper).toBe(wrapper);
expect(barba.data.current.container).toBe(container);
});
it('has current page content', () => {
barba.init();
expect(barba.data.current).toBeDefined();
expect(barba.data.current.namespace).toBe(namespace);
expect(barba.data.current.url).toEqual({
hash: undefined,
href: 'http://localhost/',
path: '/',
port: 80,
query: {},
});
expect(barba.data.current.container).toBe(container);
expect(barba.data.current.html).toMatch(/^<html>.+<\/html>$/);
});
it('init history', () => {
barba.init();
expect(barba.history.current).toEqual({
data: {},
ns: 'ns',
scroll: {
x: 0,
y: 0,
},
url: 'http://localhost/',
});
});
it('calls once', () => {
barba.once = jest.fn();
barba.init();
expect(barba.once).toHaveBeenCalledTimes(1);
});
it('gets wrapper', () => {
barba.init();
expect(barba.wrapper).toBe(wrapper);
});
it('has other options', () => {
wrapper.dataset.highway = 'main';
container.dataset.highway = 'container';
barba.init({
requestError() {
return false;
},
schema: { prefix: 'data-highway', wrapper: 'main' },
timeout: 0,
transitions: [],
views: [],
});
const requestError = () =>
barba['_requestCustomError'](
'barba',
'click',
'foo.html',
new Error('test')
);
expect(barba.timeout).toBe(0);
expect(requestError()).toBeFalsy();
expect(barba.wrapper).toBe(wrapper);
});
it('cache the first rendered page', () => {
barba.init({
cacheFirstPage: true,
});
expect(barba.cache.has('http://localhost/')).toBeTruthy();
});
================================================
FILE: packages/core/__tests__/core/core.logger.test.ts
================================================
import { init } from '../../__mocks__/barba';
import barba from '../../src';
import { Logger } from '../../src/modules/Logger';
init();
it('has default level log', () => {
expect(Logger.getLevel()).toBe(0);
});
it('has debug level log', () => {
barba.init({ debug: true });
expect(Logger.getLevel()).toBe(4);
});
it('has custom level log', () => {
barba.init({ logLevel: 'error' });
expect(Logger.getLevel()).toBe(1);
});
================================================
FILE: packages/core/__tests__/core/core.once.test.ts
================================================
/* tslint:disable:no-empty */
import { init } from '../../__mocks__/barba';
import barba from '../../src';
import { ITransitionData } from '../../src/defs';
import { Logger } from '../../src/modules/Logger';
init();
const data: ITransitionData = {
...barba.data,
trigger: 'barba',
};
afterEach(() => {
barba.destroy();
});
it('do once', async () => {
const t = { once() {} };
const spyOnce = jest.spyOn(barba.transitions, 'doOnce');
barba.transitions.store.add('transition', t);
await barba.once(data);
expect(spyOnce).toHaveBeenCalledTimes(1);
spyOnce.mockRestore();
});
================================================
FILE: packages/core/__tests__/core/core.page.test.ts
================================================
/* tslint:disable:no-empty no-string-literal */
import xhrMock from 'xhr-mock';
import { init } from '../../__mocks__/barba';
import barba from '../../src';
import { IUrlFull } from '../../src/defs';
import { hooks } from '../../src/hooks';
import { Logger } from '../../src/modules/Logger';
import { schemaAttribute } from '../../src/schemas/attribute';
import { parse } from '../../src/utils/url';
// Silence is gold… :)
Logger.setLevel('off');
// Needed for "request" module
(global as any).Headers = class {};
const namespace = 'next';
const checkDoc = new RegExp(
`^<html>[\\s\\S]+body[\\s\\S]+${schemaAttribute.wrapper}[\\s\\S]+${schemaAttribute.container}[\\s\\S]+${namespace}[\\s\\S]+</html>$`
);
const t = { leave() {}, enter() {} };
const sameUrl = 'http://localhost/';
const nextUrl = 'http://localhost/foo';
init();
let spyCacheHas: jest.SpyInstance;
let spyCacheGet: jest.SpyInstance;
let spyCacheSet: jest.SpyInstance;
let spyCacheUpdate: jest.SpyInstance;
let spyCacheGetAction: jest.SpyInstance;
let spyPage: jest.SpyInstance;
const sameHtml = `<html>
<head>
<title>Current page</title>
</head>
<body>
<div data-barba="wrapper">
<div data-barba="container" data-barba-namespace="current"></div>
</div>
</body>
</html>`;
beforeEach(() => {
barba.init();
xhrMock.setup();
xhrMock.get(sameUrl, (req, res) => res.status(200).body(sameHtml));
xhrMock.get(nextUrl, (req, res) =>
res.status(200).body(`<html>
<head>
<title>New page</title>
</head>
<body>
<div data-barba="wrapper">
<div data-barba="container" data-barba-namespace="${namespace}"></div>
</div>
</body>
</html>`)
);
spyCacheHas = jest.spyOn(barba.cache, 'has');
spyCacheGet = jest.spyOn(barba.cache, 'get');
spyCacheSet = jest.spyOn(barba.cache, 'set');
spyCacheUpdate = jest.spyOn(barba.cache, 'update');
spyCacheGetAction = jest.spyOn(barba.cache, 'getAction');
spyPage = jest.spyOn(barba.transitions, 'doPage');
});
afterEach(() => {
spyCacheHas.mockRestore();
spyCacheGet.mockRestore();
spyCacheSet.mockRestore();
spyCacheUpdate.mockRestore();
spyCacheGetAction.mockRestore();
spyPage.mockRestore();
xhrMock.teardown();
barba.destroy();
});
it('do page', async () => {
barba.history.update = jest.fn();
hooks.do = jest.fn();
barba.transitions.store.add('transition', t);
const data = {
...barba.data,
trigger: 'barba',
};
await barba.page(nextUrl, 'barba', undefined, false);
expect(spyCacheHas).toHaveBeenCalledTimes(1);
expect(spyCacheSet).toHaveBeenCalledTimes(1);
expect(barba.history.update).toHaveBeenCalledTimes(1);
expect(hooks.do).toHaveBeenNthCalledWith(1, 'page', data);
expect(hooks.do).toHaveBeenNthCalledWith(2, 'before', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(3, 'beforeLeave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(4, 'leave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(5, 'afterLeave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(6, 'nextAdded', data);
expect(hooks.do).toHaveBeenNthCalledWith(7, 'beforeEnter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(8, 'enter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(9, 'afterEnter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(10, 'currentRemoved', data);
expect(hooks.do).toHaveBeenNthCalledWith(11, 'after', data, t);
expect(barba.transitions.doPage).toHaveBeenCalledTimes(1);
expect(document.title).toBe('New page');
});
it('do page [has cache]', async () => {
barba.history.add = jest.fn();
barba.cache.set(sameUrl, Promise.resolve({
html: sameHtml,
url: {
href: sameUrl,
...parse(sameUrl)
} as IUrlFull,
}), 'init', 'pending');
spyCacheSet.mockRestore();
// NOTE: as we use "same URL" (localhost), we need a "self" transition
// to avoid prevent "sameURL"
barba.transitions.store.add('transition', { name: 'self' });
barba.transitions.store.add('transition', { leave() {}, enter() {} });
await barba.page(sameUrl, 'barba', undefined, false);
expect(spyCacheHas).toHaveBeenCalledTimes(1);
expect(spyCacheUpdate).toHaveBeenCalledTimes(1);
expect(spyCacheSet).toHaveBeenCalledTimes(0);
});
it('do page [waiting]', async () => {
// Avoid updating data.next
barba['_resetData'] = jest.fn();
barba.transitions.store.add('transition', {
leave() {},
enter() {},
to: { namespace: 'ns' },
});
await barba.page(nextUrl, 'barba', undefined, false);
expect(barba.data.next.html).toMatch(checkDoc);
});
it('force on error', async () => {
expect.assertions(2);
barba.force = jest.fn();
barba.transitions.logger.error = jest.fn();
const errorLeave = new Error('Transition error [page][leave]');
barba.transitions.store.add('transition', {
leave() {
throw errorLeave;
},
});
await barba.page(nextUrl, 'barba', undefined, false);
expect(barba.transitions.logger.error).toHaveBeenCalledWith(errorLeave);
expect(barba.force).toHaveBeenCalledTimes(1);
});
================================================
FILE: packages/core/__tests__/core/core.plugin.test.ts
================================================
/* tslint:disable:no-empty */
import { init } from '../../__mocks__/barba';
import barba from '../../src';
import { IBarbaOptions, IBarbaPlugin } from '../../src/defs';
init();
const plugin = {
name: 'p1',
version: 'alpha',
install() {},
init() {},
};
const plugin2 = {
name: 'p2',
version: 'beta',
install() {},
init() {},
};
beforeEach(() => {
barba.plugins = [];
});
it('store plugin', () => {
barba.use(plugin);
expect(barba.plugins).toHaveLength(1);
expect(barba.plugins).toContain(plugin);
});
it('store same plugin once', () => {
barba.use(plugin);
barba.use(plugin);
expect(barba.plugins).toHaveLength(1);
});
it('store different plugins', () => {
barba.use(plugin);
barba.use(plugin2);
expect(barba.plugins).toHaveLength(2);
expect(barba.plugins).toContain(plugin);
expect(barba.plugins).toContain(plugin2);
});
it('install method plugin', () => {
plugin.install = jest.fn();
barba.use(plugin);
expect(plugin.install).toHaveBeenCalledTimes(1);
});
it('init plugin', () => {
plugin.init = jest.fn();
barba.use(plugin);
barba.init();
expect(plugin.init).toHaveBeenCalledTimes(1);
});
it('warns invalid plugin', () => {
barba.logger.warn = jest.fn();
barba.use({} as IBarbaPlugin<IBarbaOptions>);
expect(barba.logger.warn).toHaveBeenCalledTimes(1);
});
================================================
FILE: packages/core/__tests__/core/core.popstate.test.ts
================================================
/* tslint:disable:no-empty no-string-literal */
import { init } from '../../__mocks__/barba';
import barba from '../../src';
init();
it('handle popstate change', () => {
barba.go = jest.fn();
const popstate = document.createEvent('HTMLEvents');
popstate.initEvent('popstate', true, false);
window.dispatchEvent(popstate);
expect(barba.go).toHaveBeenCalledTimes(1);
});
================================================
FILE: packages/core/__tests__/core/core.prefetch.test.ts
================================================
import waitForExpect from 'wait-for-expect';
import xhrMock from 'xhr-mock';
import { init } from '../../__mocks__/barba';
import barba from '../../src';
init();
// Mocks
let spySet: jest.SpyInstance;
beforeEach(() => {
spySet = jest.spyOn(barba.cache, 'set');
xhrMock.setup();
xhrMock.error(() => {}); // tslint:disable-line:no-empty
});
afterEach(() => {
spySet.mockRestore();
xhrMock.teardown();
});
it('prefetch url', () => {
const url = 'http://localhost/foo.html';
barba.prefetch(url);
expect(spySet).toHaveBeenCalledWith(url, Promise.resolve(), 'prefetch', 'pending');
});
it('prefetch and cache absolute url only', () => {
const url = '/page.html';
barba.prefetch(url);
expect(barba.cache.has('/page.html')).toBeFalsy();
expect(barba.cache.has('http://localhost/page.html')).toBeTruthy();
});
it('prefetch wrong url', async () => {
const url = 'http://localhost/bad';
barba.logger.error = jest.fn();
xhrMock.get(url, (req, res) => res.status(500));
xhrMock.error(() => {}); // tslint:disable-line:no-empty
barba.prefetch(url);
expect(spySet).toHaveBeenCalledTimes(1);
await waitForExpect(() => {
expect(barba.logger.error).toHaveBeenCalledTimes(1);
});
});
================================================
FILE: packages/core/__tests__/core/core.requestError.test.ts
================================================
/* tslint:disable:no-string-literal */
import { init } from '../../__mocks__/barba';
import barba from '../../src';
init();
barba.force = jest.fn();
const trigger = 'barba';
const href = 'url';
const error = 'error';
const request = Promise.resolve();
it('forces URL on click', () => {
barba.cache.set(href, request, 'enter', 'pending');
barba.onRequestError(trigger, href, error);
expect(barba.force).not.toHaveBeenCalled();
barba.cache.update(href, { action: 'click' });
barba.onRequestError(trigger, href, error);
expect(barba.force).toHaveBeenCalled();
});
it('calls custom request error', () => {
barba['_requestCustomError'] = jest.fn();
barba.cache.set(href, request, 'click', 'pending');
barba.onRequestError(trigger, href, error);
expect(barba['_requestCustomError']).toHaveBeenCalledWith(
trigger,
'click',
href,
error
);
expect(barba.force).toHaveBeenCalled();
});
it('does not force URL with falsy custom request error', () => {
barba['_requestCustomError'] = jest.fn(() => false);
barba.cache.set(href, request, 'click', 'pending');
barba.onRequestError(trigger, href, error);
expect(barba['_requestCustomError']).toHaveBeenCalledWith(
trigger,
'click',
href,
error
);
expect(barba.force).not.toHaveBeenCalled();
});
================================================
FILE: packages/core/__tests__/core/core.test.ts
================================================
import { init } from '../../__mocks__/barba';
import { version } from '../../package.json';
import barba from '../../src';
import { hooks } from '../../src/hooks';
import { Logger } from '../../src/modules/Logger';
import { schemaPage } from '../../src/schemas/page';
import { dom, helpers, request, url } from '../../src/utils';
it('has defaults', () => {
expect(barba.version).toBe(version);
expect(barba.schemaPage).toBe(schemaPage);
expect(barba.hooks).toBe(hooks);
expect(barba.Logger).toBe(Logger);
expect(barba.logger).toBeInstanceOf(Logger);
expect(barba.dom).toBe(dom);
expect(barba.helpers).toBe(helpers);
expect(barba.request).toBe(request);
expect(barba.url).toBe(url);
expect(barba.plugins).toHaveLength(0);
});
================================================
FILE: packages/core/__tests__/hooks/hooks.test.ts
================================================
import { HooksAll } from '../../src/defs';
import { hooks } from '../../src/hooks';
const [hookName] = hooks.all;
afterEach(() => {
hooks.clear();
});
it('has defaults', () => {
expect(hooks.all).toBeDefined();
expect(hooks.registered.size).toBe(0);
expect(hooks[hookName]).toBeDefined();
});
it('register hooks', () => {
const ctx = {};
const fn = jest.fn();
const fn2 = jest.fn();
hooks[hookName](fn, ctx);
expect(hooks.registered.has(hookName)).toBeTruthy();
expect(hooks.registered.get(hookName).size).toBe(1);
hooks[hookName](fn2);
expect(hooks.registered.get(hookName).size).toBe(2);
const values = hooks.registered.get(hookName).values();
const v1 = values.next().value;
const v2 = values.next().value;
expect(v1.fn).toBe(fn);
expect(v1.ctx).toBe(ctx);
expect(v2.fn).toBe(fn2);
expect(v2.ctx).toMatchObject({});
});
it('do nothing when no hooks', async () => {
const doUnknown = jest.fn(() => hooks.do(('unknown' as unknown) as HooksAll));
const doUnregistered = jest.fn(() => hooks.do(hooks.all[1]));
expect(doUnknown()).resolves.toBeUndefined();
expect(doUnregistered()).resolves.toBeUndefined();
});
it('do registered hooks', async () => {
const fn = jest.fn();
const fn2 = jest.fn();
hooks[hookName](fn);
hooks[hookName](fn2);
await hooks.do(hookName);
expect(fn).toHaveBeenCalledTimes(1);
expect(fn2).toHaveBeenCalledTimes(1);
});
it('do with arguments', async () => {
const expected = 'arg';
const fn = jest.fn((...args) => args);
hooks.init();
hooks[hookName](fn);
await hooks.do(hookName, expected);
expect(fn).toHaveReturnedWith([expected]);
});
it('do with context', async () => {
interface ICtx {
prop: string;
fn(): string;
}
const ctx: ICtx = {
fn: jest.fn(function(this: ICtx) {
return this.prop;
}),
prop: 'foo',
};
hooks.init();
hooks[hookName](ctx.fn, ctx);
await hooks.do(hookName);
expect(ctx.fn).toHaveReturnedWith(ctx.prop);
});
it('print help', () => {
hooks.logger.info = jest.fn();
hooks.init();
hooks[hookName]();
hooks.help();
expect(hooks.logger.info).toHaveBeenCalledTimes(2);
});
it('catch error', async () => {
expect.assertions(2);
hooks.logger.debug = jest.fn();
hooks.logger.error = jest.fn();
const err = new Error('Test error');
hooks.init();
hooks[hookName](() => {
throw err;
});
await hooks.do(hookName);
expect(hooks.logger.debug).toHaveBeenCalledWith(`Hook error [${hookName}]`);
expect(hooks.logger.error).toHaveBeenCalledWith(err);
});
================================================
FILE: packages/core/__tests__/modules/cache.test.ts
================================================
import { Cache } from '../../src/modules/Cache';
const cache = new Cache(false);
const key = 'key';
const request = Promise.resolve();
const action = 'enter';
const status = 'pending';
const target = key;
const data = {
action,
request,
status,
target,
};
it('sets, gets and has', () => {
cache.set(key, request, action, status, target);
expect(cache.has(key)).toBeTruthy();
expect(cache.get(key)).toEqual(data);
});
it('set empty target', () => {
cache.set(key, request, action, status);
expect(cache.getTarget(key)).toBe(key);
});
it('gets action, request, status and target', () => {
expect(cache.getAction(key)).toBe(action);
expect(cache.getRequest(key)).toBe(request);
expect(cache.getStatus(key)).toBe(status);
expect(cache.getTarget(key)).toBe(target);
});
it('update', () => {
cache.update(key, { action: 'click' });
expect(cache.getAction(key)).toBe('click');
});
it('deletes', () => {
cache.delete(key);
expect(cache.has(key)).toBeFalsy();
});
it('checks url', () => {
cache.checkHref = jest.fn();
cache.has(key);
expect(cache.checkHref).toHaveBeenCalled();
});
it('uses cacheIgnore', () => {
cache.checkHref = jest.fn().mockImplementation(() => true);
const res = cache.has(key);
expect(res).toBeFalsy();
});
================================================
FILE: packages/core/__tests__/modules/error.test.ts
================================================
import { BarbaError } from '../../src/modules/Error';
const err = new Error('Test error');
it('has defaults', () => {
const e = new BarbaError(err);
expect(e.name).toBe('BarbaError');
expect(e.label).toBe('Barba error');
expect(e.error).toBe(err);
});
it('has params', () => {
const e = new BarbaError(err, 'Label error', 'Message error');
expect(e.name).toBe('BarbaError');
expect(e.label).toBe('Label error');
expect(e.message).toBe('Message error');
expect(e.error).toBe(err);
});
================================================
FILE: packages/core/__tests__/modules/headers.test.ts
================================================
import { Headers } from '../../src/modules/Headers';
const headers = new Headers();
const name = 'header-name';
const value = 'header-value';
it('sets, gets and has', () => {
headers.set(name, value);
expect(headers.has(name)).toBeTruthy();
expect(headers.get(name)).toEqual(value);
});
it('deletes a custom header', () => {
headers.delete(name);
expect(headers.has(name)).toBeFalsy();
});
it('gets all headers and clear them', () => {
headers.set(name, value);
headers.clear();
expect(headers.all().size).toEqual(0);
});
================================================
FILE: packages/core/__tests__/modules/ignore.test.ts
================================================
import { Ignore } from '../../src/modules/Ignore';
let ignore: Ignore;
const url = 'http://localhost/';
const url2 = 'http://localhost/foo.html';
const url3 = 'http://localhost/bar/foo.html';
it('ignores none', () => {
ignore = new Ignore(false);
expect(ignore.checkHref(url)).toBeFalsy();
});
it('ignores all', () => {
ignore = new Ignore(true);
expect(ignore.checkHref(url)).toBeTruthy();
});
it('ignores URL', () => {
ignore = new Ignore('/');
expect(ignore.checkHref(url)).toBeTruthy();
expect(ignore.checkHref(url2)).toBeFalsy();
});
it('ignores URLs', () => {
ignore = new Ignore(['/', '/:segment/foo.html']);
expect(ignore.checkHref(url)).toBeTruthy();
expect(ignore.checkHref(url2)).toBeFalsy();
expect(ignore.checkHref(url3)).toBeTruthy();
});
================================================
FILE: packages/core/__tests__/modules/logger.test.ts
================================================
/* tslint:disable:no-string-literal */
import { Logger, LogLevels } from '../../src/modules/Logger';
let logger: Logger;
const source = 'source';
const objects = ['foo', 'bar'];
beforeEach(() => {
logger = new Logger(source);
});
// it('creates instances', () => {
// expect(logger._source).toBeUndefined();
// expect(loggerSource._source).toBe(source);
// });
it('has static log level', () => {
expect(Logger.getLevel()).toBe(0);
Logger.setLevel('error');
expect(Logger.getLevel()).toBe(1);
Logger.setLevel('warning');
expect(Logger.getLevel()).toBe(2);
Logger.setLevel('info');
expect(Logger.getLevel()).toBe(3);
Logger.setLevel('debug');
expect(Logger.getLevel()).toBe(4);
Logger.setLevel('off');
expect(Logger.getLevel()).toBe(0);
});
it('logs all levels', () => {
logger['_log'] = jest.fn();
logger.error(...objects);
logger.warn(...objects);
logger.info(...objects);
logger.debug(...objects);
expect(logger['_log']).toHaveBeenNthCalledWith(1, console.error, 1, objects);
expect(logger['_log']).toHaveBeenNthCalledWith(2, console.warn, 2, objects);
expect(logger['_log']).toHaveBeenNthCalledWith(3, console.info, 3, objects);
expect(logger['_log']).toHaveBeenNthCalledWith(4, console.log, 4, objects);
});
it('logs with source', () => {
Logger.setLevel('debug');
global.console.log = jest.fn();
logger.debug(...objects);
expect(global.console.log).toHaveBeenCalledWith(`[${source}] `, ...objects);
});
it('logs all when level is debug', () => {
const mock = jest.fn();
const levels = ['off', 'error', 'warning', 'info', 'debug'];
global.console.log = mock;
global.console.info = mock;
global.console.warn = mock;
global.console.error = mock;
levels.forEach((level, i) => {
Logger.setLevel(level as keyof typeof LogLevels);
logger.debug();
logger.info();
logger.warn();
logger.error();
expect(mock).toHaveBeenCalledTimes(i);
mock.mockReset();
});
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.blank.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
const el = document.createElement('a');
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('blank')(data));
[].slice.call(el.attributes).forEach(attr => el.removeAttribute(attr.name));
});
it('pass', () => {
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('pass with different target attribute', () => {
el.setAttribute('target', '_self');
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with target "_blank"', () => {
el.setAttribute('target', '_blank');
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.corsDomain.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
const el = document.createElement('a');
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('corsDomain')(data));
[].slice.call(el.attributes).forEach(attr => el.removeAttribute(attr.name));
});
it('pass', () => {
el.href = 'http://localhost';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with different protocol', () => {
el.href = 'https://localhost';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with different hostname', () => {
el.href = 'https://domain.com';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.corsPort.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
const el = document.createElement('a');
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('corsPort')(data));
[].slice.call(el.attributes).forEach(attr => el.removeAttribute(attr.name));
});
it('pass', () => {
el.href = 'http://localhost';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with different port', () => {
el.href = 'https://localhost:8888';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.download.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
const el = document.createElement('a');
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('download')(data));
[].slice.call(el.attributes).forEach(attr => el.removeAttribute(attr.name));
});
it('pass', () => {
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with download attribute', () => {
el.setAttribute('download', 'true');
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.exists.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('exists')(data));
});
it('pass (with element and href)', () => {
check(({ el: true, href: true } as unknown) as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with no element and no href', () => {
check(({ el: false, href: false } as unknown) as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with element but no href', () => {
check(({ el: true, href: false } as unknown) as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with no element but href', () => {
check(({ el: false, href: true } as unknown) as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.newTab.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('newTab')(data));
});
it('pass', () => {
check({
event: ({
altKey: false,
ctrlKey: false,
metaKey: false,
shiftKey: false,
which: 0,
} as unknown) as Event,
} as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with "which"', () => {
check({ event: ({ which: 2 } as unknown) as Event } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with "metaKey"', () => {
check({
event: ({ metaKey: true } as unknown) as Event,
} as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with "ctrlKey"', () => {
check({
event: ({ ctrlKey: true } as unknown) as Event,
} as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with "shiftKey"', () => {
check({
event: ({ shiftKey: true } as unknown) as Event,
} as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with "altKey"', () => {
check({ event: ({ altKey: true } as unknown) as Event } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.preventAll.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
const el = document.createElement('a');
const parent = document.createElement('div');
parent.appendChild(el);
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('preventAll')(data));
[].slice.call(el.attributes).forEach(attr => el.removeAttribute(attr.name));
});
it('pass', () => {
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with data-barba-prevent="all"', () => {
parent.dataset.barbaPrevent = 'all';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.preventSelf.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
const el = document.createElement('a');
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('preventSelf')(data));
[].slice.call(el.attributes).forEach(attr => el.removeAttribute(attr.name));
});
it('pass', () => {
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with data-barba-prevent', () => {
el.dataset.barbaPrevent = '';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
it('prevent with data-barba-prevent="self"', () => {
el.dataset.barbaPrevent = 'self';
check({ el } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.sameUrl.test.ts
================================================
import { IPreventCheckData, PreventCheck } from '../../../src/defs';
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
let check: PreventCheck;
beforeEach(() => {
check = jest.fn(data => prevent.tests.get('sameUrl')(data));
});
it('pass', () => {
check({ href: 'somewhere' } as IPreventCheckData);
expect(check).toHaveReturnedWith(false);
});
it('prevent with same url', () => {
check({ href: window.location.href } as IPreventCheckData);
expect(check).toHaveReturnedWith(true);
});
================================================
FILE: packages/core/__tests__/modules/prevent/prevent.test.ts
================================================
import { Prevent } from '../../../src/modules/Prevent';
const prevent = new Prevent(false);
it('adds test', () => {
const name = 'fake';
const check = () => true;
prevent.add(name, check);
expect(prevent.tests.get(name)).toBe(check);
});
================================================
FILE: packages/core/__tests__/modules/store/store.add.test.ts
================================================
/* tslint:disable:no-string-literal */
import { Store } from '../../../src/modules/Store';
let store: Store;
beforeEach(() => {
store = new Store();
});
it('add rule', () => {
const nb = store['_rules'].length;
const r = {
name: 'test',
type: 'strings',
};
store.add('rule', {
value: r,
});
expect(store['_rules']).toHaveLength(nb + 1);
expect(store['_rules'][0]).toBe(r);
});
it('add rule with position', () => {
const nb = store['_rules'].length;
const r = {
name: 'test',
type: 'strings',
};
store.add('rule', {
position: 1,
value: r,
});
expect(store['_rules']).toHaveLength(nb + 1);
expect(store['_rules'][1]).toBe(r);
});
it('add transition', () => {
const nb = store.all.length;
const t = {};
store.add('transition', t);
expect(store.all).toHaveLength(nb + 1);
expect(store.all[0]).toBe(t);
});
================================================
FILE: packages/core/__tests__/modules/store/store.addPriority.test.ts
================================================
/* tslint:disable:no-string-literal */
import { IRule, ITransitionPage } from '../../../src/defs';
import { Store } from '../../../src/modules/Store';
const store = new Store();
const rules: IRule[] = [
({ name: 'tens', type: 'strings' } as unknown) as IRule,
({ name: 'hundreds', type: 'strings' } as unknown) as IRule,
];
store['_rules'] = rules;
it('add priority 0', () => {
expect(store['_addPriority']({}).priority).toBe(0);
});
it('add priority 10', () => {
expect(
store['_addPriority'](({ tens: true } as unknown) as ITransitionPage)
.priority
).toBe(10);
});
it('add priority 11', () => {
expect(
store['_addPriority'](({
from: { tens: true },
} as unknown) as ITransitionPage).priority
).toBe(11);
});
it('add priority 12', () => {
expect(
store['_addPriority'](({
to: { tens: true },
} as unknown) as ITransitionPage).priority
).toBe(12);
});
it('add priority 13', () => {
expect(
store['_addPriority'](({
from: { tens: true },
to: { tens: true },
} as unknown) as ITransitionPage).priority
).toBe(13);
});
it('add priority 100', () => {
expect(
store['_addPriority'](({ hundreds: true } as unknown) as ITransitionPage)
.priority
).toBe(100);
});
it('add priority 101', () => {
expect(
store['_addPriority'](({
from: { hundreds: true },
} as unknown) as ITransitionPage).priority
).toBe(101);
});
it('add priority 102', () => {
expect(
store['_addPriority'](({
to: { hundreds: true },
} as unknown) as ITransitionPage).priority
).toBe(102);
});
it('add priority 103', () => {
expect(
store['_addPriority'](({
from: { hundreds: true },
to: { hundreds: true },
} as unknown) as ITransitionPage).priority
).toBe(103);
});
it('add priority 110', () => {
expect(
store['_addPriority'](({
hundreds: true,
tens: true,
} as unknown) as ITransitionPage).priority
).toBe(110);
});
it('add priority 112', () => {
expect(
store['_addPriority'](({
from: { tens: true, hundreds: true },
} as unknown) as ITransitionPage).priority
).toBe(112);
});
it('add priority 114', () => {
expect(
store['_addPriority'](({
to: { tens: true, hundreds: true },
} as unknown) as ITransitionPage).priority
).toBe(114);
});
it('add priority 116', () => {
expect(
store['_addPriority'](({
from: { tens: true, hundreds: true },
to: { tens: true, hundreds: true },
} as unknown) as ITransitionPage).priority
).toBe(116);
});
================================================
FILE: packages/core/__tests__/modules/store/store.check.test.ts
================================================
/* tslint:disable:no-string-literal */
import {
IRule,
ISchemaPage,
ITransitionData,
ITransitionPage,
} from '../../../src/defs';
import { Store } from '../../../src/modules/Store';
import { schemaPage } from '../../../src/schemas/page';
let match = {};
const store = new Store();
store.add('rule', {
position: 1,
value: {
name: 'route',
type: 'object',
},
});
schemaPage.route = { name: '', params: {} };
const mockData: ITransitionData = {
current: schemaPage,
next: schemaPage,
trigger: 'barba',
};
beforeEach(() => {
match = {};
});
/**
* Check rules
*
* Based on rule type: strings | object | function
* 1. transition has no rule "property":
* - always returns true
* 2. transition has rule "property":
* - "strings" should be present on both side (transition + view) and match
* - "function" should return true
*/
/**
* Run "strings" check test
*/
function runStrings(
transition: ITransitionPage,
rule: IRule,
data: ITransitionData,
direction?: 'from' | 'to'
) {
const fail = store['_check'](transition, rule, mockData, match, direction);
expect(fail).toBeFalsy();
expect(match).toMatchObject({});
const ok = store['_check'](transition, rule, data, match, direction);
expect(ok).toBeTruthy();
expect(match).toMatchObject(transition);
}
/**
* Run "object" check test
*/
function runObject(
transition: ITransitionPage,
rule: IRule,
data: ITransitionData,
direction?: 'from' | 'to'
) {
const fail = store['_check'](transition, rule, mockData, match, direction);
expect(fail).toBeFalsy();
expect(match).toMatchObject({});
const ok = store['_check'](transition, rule, data, match, direction);
expect(ok).toBeTruthy();
expect(match).toMatchObject(transition);
}
/**
* Run "function" check test
*/
function runFunction(
falsy: ITransitionPage,
truthy: ITransitionPage,
rule: IRule,
direction?: 'from' | 'to'
) {
const fail = store['_check'](falsy, rule, mockData, match, direction);
expect(fail).toBeFalsy();
expect(match).toMatchObject({});
const ok = store['_check'](truthy, rule, mockData, match, direction);
expect(ok).toBeTruthy();
expect(match).toMatchObject(truthy);
}
// "strings" type
it('check valid for inexisting rule "strings"', () => {
const [rule] = store['_rules'].filter(r => r.name === 'namespace');
const expected = store['_check'](
{},
rule,
({ namespace: 'ns' } as unknown) as ITransitionData,
match
);
expect(expected).toBeTruthy();
expect(match).toMatchObject({});
});
it('check single "strings"', () => {
const transition = { namespace: 'ns' };
const [rule] = store['_rules'].filter(r => r.name === 'namespace');
const data = { current: { namespace: 'ns' } };
runStrings(transition, rule, (data as unknown) as ITransitionData);
});
it('check single "strings" with "from"', () => {
const transition = { from: { namespace: 'ns' } };
const [rule] = store['_rules'].filter(r => r.name === 'namespace');
const data = { current: { namespace: 'ns' } };
runStrings(transition, rule, (data as unknown) as ITransitionData, 'from');
});
it('check single "strings" with "to"', () => {
const transition = { to: { namespace: 'ns' } };
const [rule] = store['_rules'].filter(r => r.name === 'namespace');
const data = { next: { namespace: 'ns' } };
runStrings(transition, rule, (data as unknown) as ITransitionData, 'to');
});
it('check array "strings"', () => {
const transition = { namespace: ['ns'] };
const [rule] = store['_rules'].filter(r => r.name === 'namespace');
const data = { current: { namespace: 'ns' } };
runStrings(transition, rule, (data as unknown) as ITransitionData);
});
it('check array "strings" with "from"', () => {
const transition = { from: { namespace: ['ns'] } };
const [rule] = store['_rules'].filter(r => r.name === 'namespace');
const data = { current: { namespace: 'ns' } };
runStrings(transition, rule, (data as unknown) as ITransitionData, 'from');
});
it('check array "strings" with "to"', () => {
const transition = { to: { namespace: ['ns'] } };
const [rule] = store['_rules'].filter(r => r.name === 'namespace');
const data = { next: { namespace: 'ns' } };
runStrings(transition, rule, (data as unknown) as ITransitionData, 'to');
});
// "object" type
it('check valid for inexisting rule "object"', () => {
const [rule] = store['_rules'].filter(r => r.name === 'route');
const expected = store['_check'](
{},
rule,
({ route: 'r' } as unknown) as ITransitionData,
match
);
expect(expected).toBeTruthy();
expect(match).toMatchObject({});
});
it('check invalid for non matching rule "object"', () => {
const transition = { route: 'r' };
const [rule] = store['_rules'].filter(r => r.name === 'route');
const data = { current: { route: null } as ISchemaPage };
const expected = store['_check'](
transition,
rule,
(data as unknown) as ITransitionData,
match
);
expect(expected).toBeFalsy();
expect(match).toMatchObject({});
});
it('check single "object"', () => {
const transition = { route: 'r' };
const [rule] = store['_rules'].filter(r => r.name === 'route');
const data = { current: { route: { name: 'r' } } };
runObject(transition, rule, (data as unknown) as ITransitionData);
});
it('check single "object" with "from"', () => {
const transition = { from: { route: 'r' } };
const [rule] = store['_rules'].filter(r => r.name === 'route');
const data = { current: { route: { name: 'r' } } };
runObject(transition, rule, (data as unknown) as ITransitionData, 'from');
});
it('check single "object" with "to"', () => {
const transition = { to: { route: 'r' } };
const [rule] = store['_rules'].filter(r => r.name === 'route');
const data = { next: { route: { name: 'r' } } };
runObject(transition, rule, (data as unknown) as ITransitionData, 'to');
});
it('check array "object"', () => {
const transition = { route: ['r'] };
const [rule] = store['_rules'].filter(r => r.name === 'route');
const data = { current: { route: { name: 'r' } } };
runObject(transition, rule, (data as unknown) as ITransitionData);
});
it('check array "object" with "from"', () => {
const transition = { from: { route: ['r'] } };
const [rule] = store['_rules'].filter(r => r.name === 'route');
const data = { current: { route: { name: 'r' } } };
runObject(transition, rule, (data as unknown) as ITransitionData, 'from');
});
it('check array "object" with "to"', () => {
const transition = { to: { route: ['r'] } };
const [rule] = store['_rules'].filter(r => r.name === 'route');
const data = { next: { route: { name: 'r' } } };
runObject(transition, rule, (data as unknown) as ITransitionData, 'to');
});
// "function" type
it('check valid for inexisting rule "function"', () => {
const [rule] = store['_rules'].filter(r => r.name === 'custom');
const expected = store['_check'](
{},
rule,
({} as unknown) as ITransitionData,
match
);
expect(expected).toBeTruthy();
expect(match).toMatchObject({});
});
it('check "function"', () => {
const falsy = { custom: () => false };
const truthy = { custom: () => true };
const [rule] = store['_rules'].filter(r => r.name === 'custom');
runFunction(falsy, truthy, rule);
});
it('check "function" with "from"', () => {
const falsy = { from: { custom: () => false } };
const truthy = { from: { custom: () => true } };
const [rule] = store['_rules'].filter(r => r.name === 'custom');
runFunction(falsy, truthy, rule, 'from');
});
it('check "function" with "to"', () => {
const falsy = { to: { custom: () => false } };
const truthy = { to: { custom: () => true } };
const [rule] = store['_rules'].filter(r => r.name === 'custom');
runFunction(falsy, truthy, rule, 'to');
});
================================================
FILE: packages/core/__tests__/modules/store/store.log.test.ts
================================================
import { Logger } from '../../../src/modules/Logger';
import { Store } from '../../../src/modules/Store';
import { schemaPage } from '../../../src/schemas/page';
it('has debug info', () => {
const store = new Store([]);
Logger.setLevel('info');
store.logger.info = jest.fn();
store.resolve({
current: schemaPage,
next: schemaPage,
trigger: 'barba',
});
expect(store.logger.info).toHaveBeenCalledTimes(1);
});
================================================
FILE: packages/core/__tests__/modules/store/store.resolve.once.test.ts
================================================
import { ITransitionData, ITransitionOnce } from '../../../src/defs';
import { Store } from '../../../src/modules/Store';
const tOnce: ITransitionOnce = { once: () => Promise.resolve() };
const tOnceNs: ITransitionOnce = {
namespace: 'ns',
once: () => Promise.resolve(),
};
const tOnceCustom: ITransitionOnce = {
once: () => Promise.resolve(),
custom({ current }) {
return current.namespace === 'custom';
},
};
const store = new Store([tOnce, tOnceNs, tOnceCustom]);
it('has no transition', async () => {
const emptyStore = new Store();
emptyStore.logger.info = jest.fn();
emptyStore.resolve(({} as unknown) as ITransitionData, { once: true });
expect(emptyStore.logger.info).toHaveBeenCalledWith(
'No transition found [once]'
);
});
it('get "once" transition', () => {
const result = store.resolve(
({
current: { namespace: 'none' },
} as unknown) as ITransitionData,
{ once: true }
);
expect(result).toBe(tOnce);
});
it('get "once/ns" transition', () => {
const result = store.resolve(
({
current: { namespace: 'ns' },
} as unknown) as ITransitionData,
{ once: true }
);
expect(result).toBe(tOnceNs);
});
it('get "once/custom" transition', () => {
const result = store.resolve(
({
current: { namespace: 'custom' },
} as unknown) as ITransitionData,
{ once: true }
);
expect(result).toBe(tOnceCustom);
});
================================================
FILE: packages/core/__tests__/modules/store/store.resolve.page.test.ts
================================================
/* tslint:disable:no-empty */
import { ITransitionData } from '../../../src/defs';
import { Store } from '../../../src/modules/Store';
const t = { enter() {} };
const tNs = { enter() {}, namespace: 'ns' };
const tNsFrom = { enter() {}, from: { namespace: 'nsFrom' } };
const tNsTo = { enter() {}, to: { namespace: 'nsTo' } };
const tNsFromTo = {
enter() {},
from: { namespace: 'nsFrom' },
to: { namespace: 'nsTo' },
};
const tSelf = { enter() {}, name: 'self' };
const store = new Store([t, tNs, tNsFrom, tNsTo, tNsFromTo, tSelf]);
it('has no transition', async () => {
const emptyStore = new Store();
emptyStore.logger.info = jest.fn();
emptyStore.resolve(({} as unknown) as ITransitionData);
expect(emptyStore.logger.info).toHaveBeenCalledWith(
'No transition found [page]'
);
});
it('get "page" transition', () => {
const result = store.resolve(({
current: true,
next: true,
} as unknown) as ITransitionData);
expect(result).toBe(t);
});
it('get "page/ns" transition', () => {
const result = store.resolve(({
current: { namespace: 'ns' },
next: {},
} as unknown) as ITransitionData);
expect(result).toBe(tNs);
});
it('get "page/from" transition', () => {
const result = store.resolve(({
current: { namespace: 'nsFrom' },
next: {},
} as unknown) as ITransitionData);
expect(result).toBe(tNsFrom);
});
it('get "page/to" transition', () => {
const result = store.resolve(({
current: {},
next: { namespace: 'nsTo' },
} as unknown) as ITransitionData);
expect(result).toBe(tNsTo);
});
it('get "page/fromTo" transition', () => {
const result = store.resolve(({
current: { namespace: 'nsFrom' },
next: { namespace: 'nsTo' },
} as unknown) as ITransitionData);
expect(result).toBe(tNsFromTo);
});
it('get "self" transition', () => {
const result = store.resolve(
({
current: { namespace: 'nsFrom' },
next: { namespace: 'nsTo' },
} as unknown) as ITransitionData,
{ self: true }
);
expect(result).toBe(tSelf);
});
================================================
FILE: packages/core/__tests__/modules/store/store.test.ts
================================================
import { Store } from '../../../src/modules/Store';
let store: Store;
it('has defaults', () => {
store = new Store([]);
expect(store.all).toHaveLength(0);
expect(store.once).toHaveLength(0);
});
it('adds transitions', () => {
store = new Store([{}]);
expect(store.all).toHaveLength(1);
});
================================================
FILE: packages/core/__tests__/modules/store/store.update.sort.test.ts
================================================
import shuffle from 'lodash/shuffle';
import transitions from '../../../__mocks__/transitions';
import { Store } from '../../../src/modules/Store';
let store: Store;
const expected = transitions.map(t => t.name).reverse();
const times = (x: number) => (f: () => void) => {
if (x > 0) {
f();
times(x - 1)(f);
}
};
const r = {
name: 'route',
type: 'strings',
};
times(50)(() => {
it('sort all', () => {
store = new Store(shuffle(transitions));
store.add('rule', {
position: 1,
value: r,
});
expect(store.all).toHaveLength(transitions.length);
expect(store.all.map(t => t.name)).toEqual(expected);
});
});
================================================
FILE: packages/core/__tests__/modules/store/store.update.test.ts
================================================
/* tslint:disable:no-empty */
import { Store } from '../../../src/modules/Store';
let store: Store;
let nb: number;
beforeEach(() => {
nb = 0;
});
it('update all', () => {
store = new Store([{}]);
expect(store.all).toHaveLength(nb + 1);
expect(store.once).toHaveLength(0);
});
it('update once', () => {
store = new Store([{ once() {} }]);
expect(store.all).toHaveLength(nb + 1);
expect(store.once).toHaveLength(nb + 1);
});
it('update page', () => {
store = new Store([{ enter() {} }]);
expect(store.all).toHaveLength(nb + 1);
expect(store.once).toHaveLength(0);
});
it('update once and page', () => {
store = new Store([{ once() {}, enter() {} }]);
expect(store.all).toHaveLength(nb + 1);
expect(store.once).toHaveLength(nb + 1);
});
================================================
FILE: packages/core/__tests__/modules/transitions/transitions.async.test.ts
================================================
import { ISchemaPage, ITransitionData } from '../../../src/defs';
import { hooks } from '../../../src/hooks';
import { Transitions } from '../../../src/modules/Transitions';
const transitions = new Transitions();
// Mocks
const enter = jest.fn();
// Shared
const div = document.createElement('div');
const wrapper = div.cloneNode() as HTMLElement;
const currentContainer = div.cloneNode() as HTMLElement;
const nextContainer = div.cloneNode() as HTMLElement;
// Data
const data: ITransitionData = {
current: {
container: currentContainer,
} as ISchemaPage,
next: {
container: nextContainer,
} as ISchemaPage,
trigger: 'barba',
};
const payload = 'payload';
/**
* Just do page…
*/
async function doPage(leave: any) {
await transitions.doPage({
data,
page: Promise.resolve(),
transition: { leave, enter },
wrapper,
});
}
beforeEach(() => {
hooks.init();
});
it('returns with "promise"', async () => {
expect.assertions(1);
const leavePromise = () => Promise.resolve(payload);
await doPage(leavePromise);
expect(enter).toHaveBeenCalledWith(data, payload);
});
it('returns with "callback"', async () => {
expect.assertions(1);
const ctx: any = {
leaveCallback() {
const done = this.async();
done(null, payload);
},
};
await doPage(ctx.leaveCallback);
expect(enter).toHaveBeenCalledWith(data, payload);
});
it('returns with "sync"', async () => {
expect.assertions(1);
const leaveSync = () => payload;
await doPage(leaveSync);
expect(enter).toHaveBeenCalledWith(data, payload);
});
================================================
FILE: packages/core/__tests__/modules/transitions/transitions.context.test.ts
================================================
import {
ISchemaPage,
ITransitionData,
ITransitionOnce,
} from '../../../src/defs';
import { Logger } from '../../../src/modules/Logger';
import { Transitions } from '../../../src/modules/Transitions';
// Silence is gold… :)
Logger.setLevel('off');
const transitions = new Transitions([]);
// Data
let data: ITransitionData;
beforeEach(() => {
data = {
current: {} as ISchemaPage,
next: {} as ISchemaPage,
trigger: 'barba',
};
});
it('calls methods', async () => {
const t = {
bar: jest.fn(),
once() {
this.bar(this.foo);
},
foo: 'foo',
};
await transitions.doOnce({
data,
transition: (t as any) as ITransitionOnce,
});
expect(t.bar).toHaveBeenCalledWith(t.foo);
});
================================================
FILE: packages/core/__tests__/modules/transitions/transitions.get.test.ts
================================================
import { ISchemaPage, ITransitionData } from '../../../src/defs';
import { Transitions } from '../../../src/modules/Transitions';
const once = {
once: () => Promise.resolve(),
};
const enter = {
enter: () => Promise.resolve(),
};
const transitions = new Transitions([once, enter]);
const data: ITransitionData = {
current: {} as ISchemaPage,
next: {} as ISchemaPage,
trigger: 'barba',
};
it('gets page transition', () => {
expect(transitions.get(data)).toBe(enter);
});
it('gets once transition', () => {
expect(transitions.get(data, { once: true })).toBe(once);
});
================================================
FILE: packages/core/__tests__/modules/transitions/transitions.once.test.ts
================================================
import {
ISchemaPage,
ITransitionData,
ITransitionOnce,
} from '../../../src/defs';
import { hooks } from '../../../src/hooks';
import { Logger } from '../../../src/modules/Logger';
import { Transitions } from '../../../src/modules/Transitions';
// Silence is gold… :)
Logger.setLevel('off');
const transitions = new Transitions([]);
// Mocks
const beforeOnce = jest.fn();
const once = jest.fn();
const afterOnce = jest.fn();
hooks.do = jest.fn();
// Data
let data: ITransitionData;
beforeEach(() => {
data = {
current: {} as ISchemaPage,
next: {} as ISchemaPage,
trigger: 'barba',
};
});
it('does not need once', async () => {
expect.assertions(1);
await transitions.doOnce({
data,
transition: undefined as ITransitionOnce,
});
expect(hooks.do).toHaveBeenNthCalledWith(2, 'once', data, {});
});
it('calls methods', async () => {
expect.assertions(9);
await transitions.doOnce({
data,
transition: { beforeOnce, once, afterOnce },
});
expect(beforeOnce).toHaveBeenCalledTimes(1);
expect(beforeOnce).toHaveBeenCalledWith(data);
expect(once).toHaveBeenCalledTimes(1);
expect(once).toHaveBeenCalledWith(data);
expect(afterOnce).toHaveBeenCalledTimes(1);
expect(afterOnce).toHaveBeenCalledWith(data);
await transitions.doOnce({ data, transition: { once } });
expect(beforeOnce).toHaveBeenCalledTimes(1);
expect(once).toHaveBeenCalledTimes(2);
expect(afterOnce).toHaveBeenCalledTimes(1);
});
it('calls hooks', async () => {
expect.assertions(4);
const t = { once: () => Promise.resolve() };
await transitions.doOnce({ data, transition: t });
expect(hooks.do).toHaveBeenCalledTimes(3);
expect(hooks.do).toHaveBeenNthCalledWith(1, 'beforeOnce', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(2, 'once', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(3, 'afterOnce', data, t);
});
it('catches error', async () => {
expect.assertions(2);
transitions.logger.debug = jest.fn();
transitions.logger.error = jest.fn();
const err = new Error('Test');
const onceError = () => {
throw err;
};
const t = { once: onceError };
await transitions.doOnce({
data,
transition: t,
});
expect(transitions.logger.debug).toHaveBeenCalledWith(
'Transition error [before/after/once]'
);
expect(transitions.logger.error).toHaveBeenCalledWith(err);
});
================================================
FILE: packages/core/__tests__/modules/transitions/transitions.page.test.ts
================================================
/* tslint:disable:no-empty */
import { init } from '../../../__mocks__/barba';
import barba from '../../../src';
import { IResponse, ISchemaPage, ITransitionData } from '../../../src/defs';
import { hooks } from '../../../src/hooks';
import { Logger } from '../../../src/modules/Logger';
import { Transitions } from '../../../src/modules/Transitions';
// Silence is gold… :)
Logger.setLevel('off');
const transitions = new Transitions([]);
// Mocks
const before = jest.fn();
const after = jest.fn();
const beforeLeave = jest.fn();
const leave = jest.fn();
const afterLeave = jest.fn();
const beforeEnter = jest.fn();
const enter = jest.fn();
const afterEnter = jest.fn();
hooks.do = jest.fn();
// Dom
const { wrapper, container: currentContainer } = init();
// const div = document.createElement('div');
// const wrapper = div.cloneNode() as HTMLElement;
// const currentContainer = div.cloneNode() as HTMLElement;
// const nextContainer = div.cloneNode() as HTMLElement;
const nextContainer = currentContainer.cloneNode() as HTMLElement;
const nextHtml = `<html>
<body>
<div data-barba="wrapper">
<div data-barba="container" data-barba-namespace="next">
Next page
</div>
</div>
</body>
</html>`;
// Data
let data: ITransitionData;
beforeEach(() => {
nextContainer.remove();
wrapper.appendChild(currentContainer);
data = {
current: {
container: currentContainer,
html: undefined,
url: {},
} as ISchemaPage,
next: {
container: nextContainer,
html: undefined,
url: {},
} as ISchemaPage,
trigger: 'barba',
};
});
const page = Promise.resolve({
html: nextHtml,
url: {},
} as IResponse);
it('leaves falsy', async () => {
expect.assertions(1);
await transitions.doPage({
data,
page,
transition: { leave: () => Promise.resolve(false) },
wrapper,
});
expect(beforeEnter).not.toHaveBeenCalled();
});
for (let i = 0; i < 2; i++) {
const sync = i === 0;
it('calls methods', async () => {
expect.assertions(20);
const t = {
after,
afterEnter,
afterLeave,
before,
beforeEnter,
beforeLeave,
enter,
leave,
sync,
};
await transitions.doPage({
data,
page,
transition: t,
wrapper,
});
expect(before).toHaveBeenCalledTimes(1);
expect(before).toHaveBeenCalledWith(data);
expect(beforeLeave).toHaveBeenCalledTimes(1);
expect(beforeLeave).toHaveBeenCalledWith(data);
expect(leave).toHaveBeenCalledTimes(1);
expect(leave).toHaveBeenCalledWith(data);
expect(afterLeave).toHaveBeenCalledTimes(1);
expect(afterLeave).toHaveBeenCalledWith(data);
expect(beforeEnter).toHaveBeenCalledTimes(1);
expect(beforeEnter).toHaveBeenCalledWith(data);
expect(enter).toHaveBeenCalledTimes(1);
expect(enter).toHaveBeenCalledWith(data, undefined);
expect(afterEnter).toHaveBeenCalledTimes(1);
expect(afterEnter).toHaveBeenCalledWith(data);
expect(after).toHaveBeenCalledTimes(1);
expect(after).toHaveBeenCalledWith(data);
await transitions.doPage({
data,
page: Promise.resolve(),
transition: { leave, enter },
wrapper,
});
expect(before).toHaveBeenCalledTimes(1);
expect(leave).toHaveBeenCalledTimes(2);
expect(enter).toHaveBeenCalledTimes(2);
expect(after).toHaveBeenCalledTimes(1);
});
}
it('calls hooks (sync: false)', async () => {
expect.assertions(11);
const t = {
enter,
leave,
sync: false,
};
await transitions.doPage({
data,
page,
transition: t,
wrapper,
});
expect(hooks.do).toHaveBeenCalledTimes(10);
expect(hooks.do).toHaveBeenNthCalledWith(1, 'before', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(2, 'beforeLeave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(3, 'leave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(4, 'afterLeave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(5, 'nextAdded', data);
expect(hooks.do).toHaveBeenNthCalledWith(6, 'beforeEnter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(7, 'enter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(8, 'afterEnter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(9, 'currentRemoved', data);
expect(hooks.do).toHaveBeenNthCalledWith(10, 'after', data, t);
});
it('calls hooks (sync: true)', async () => {
expect.assertions(11);
const t = {
enter,
leave,
sync: true,
};
await transitions.doPage({
data,
page,
transition: t,
wrapper,
});
expect(hooks.do).toHaveBeenCalledTimes(10);
expect(hooks.do).toHaveBeenNthCalledWith(1, 'before', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(2, 'nextAdded', data);
expect(hooks.do).toHaveBeenNthCalledWith(3, 'beforeLeave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(4, 'beforeEnter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(5, 'leave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(6, 'enter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(7, 'afterLeave', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(8, 'afterEnter', data, t);
expect(hooks.do).toHaveBeenNthCalledWith(9, 'currentRemoved', data);
expect(hooks.do).toHaveBeenNthCalledWith(10, 'after', data, t);
});
it('catches error (leave, sync: false)', async () => {
expect.assertions(4);
const leaveError = () => {
throw new Error('test');
};
const t = { leave: leaveError };
try {
gitextract_lsxzgmju/ ├── .all-contributorsrc ├── .circleci/ │ └── config.yml ├── .editorconfig ├── .eslintrc.js ├── .github/ │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug-report.yml │ │ └── config.yml │ └── stale.yml ├── .gitignore ├── .lintstagedrc ├── .markdownlint.json ├── .vscode/ │ └── settings.json ├── AUTHORS ├── CI.md ├── LICENSE.md ├── NOTES.md ├── README.md ├── TODO.md ├── commitlint.config.js ├── cypress/ │ ├── fixtures/ │ │ └── example.json │ ├── plugins/ │ │ └── index.js │ └── support/ │ ├── commands.js │ └── e2e.js ├── cypress.config.ts ├── documentation/ │ └── theme/ │ ├── assets/ │ │ └── css/ │ │ └── override.css │ └── layouts/ │ └── default.hbs ├── jest.config.js ├── lerna.json ├── package.json ├── packages/ │ ├── core/ │ │ ├── .npmignore │ │ ├── AUTHORS │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __e2e__/ │ │ │ ├── container.spec.js │ │ │ ├── default.spec.js │ │ │ ├── hooks.spec.js │ │ │ ├── href.spec.js │ │ │ └── views.spec.js │ │ ├── __mocks__/ │ │ │ ├── barba.ts │ │ │ └── transitions.ts │ │ ├── __tests__/ │ │ │ ├── core/ │ │ │ │ ├── core.click.test.ts │ │ │ │ ├── core.enter.test.ts │ │ │ │ ├── core.force.test.ts │ │ │ │ ├── core.go.test.ts │ │ │ │ ├── core.init.test.ts │ │ │ │ ├── core.logger.test.ts │ │ │ │ ├── core.once.test.ts │ │ │ │ ├── core.page.test.ts │ │ │ │ ├── core.plugin.test.ts │ │ │ │ ├── core.popstate.test.ts │ │ │ │ ├── core.prefetch.test.ts │ │ │ │ ├── core.requestError.test.ts │ │ │ │ └── core.test.ts │ │ │ ├── hooks/ │ │ │ │ └── hooks.test.ts │ │ │ ├── modules/ │ │ │ │ ├── cache.test.ts │ │ │ │ ├── error.test.ts │ │ │ │ ├── headers.test.ts │ │ │ │ ├── ignore.test.ts │ │ │ │ ├── logger.test.ts │ │ │ │ ├── prevent/ │ │ │ │ │ ├── prevent.blank.test.ts │ │ │ │ │ ├── prevent.corsDomain.test.ts │ │ │ │ │ ├── prevent.corsPort.test.ts │ │ │ │ │ ├── prevent.download.test.ts │ │ │ │ │ ├── prevent.exists.test.ts │ │ │ │ │ ├── prevent.newTab.test.ts │ │ │ │ │ ├── prevent.preventAll.test.ts │ │ │ │ │ ├── prevent.preventSelf.test.ts │ │ │ │ │ ├── prevent.sameUrl.test.ts │ │ │ │ │ └── prevent.test.ts │ │ │ │ ├── store/ │ │ │ │ │ ├── store.add.test.ts │ │ │ │ │ ├── store.addPriority.test.ts │ │ │ │ │ ├── store.check.test.ts │ │ │ │ │ ├── store.log.test.ts │ │ │ │ │ ├── store.resolve.once.test.ts │ │ │ │ │ ├── store.resolve.page.test.ts │ │ │ │ │ ├── store.test.ts │ │ │ │ │ ├── store.update.sort.test.ts │ │ │ │ │ └── store.update.test.ts │ │ │ │ ├── transitions/ │ │ │ │ │ ├── transitions.async.test.ts │ │ │ │ │ ├── transitions.context.test.ts │ │ │ │ │ ├── transitions.get.test.ts │ │ │ │ │ ├── transitions.once.test.ts │ │ │ │ │ ├── transitions.page.test.ts │ │ │ │ │ └── transitions.test.ts │ │ │ │ └── views.test.ts │ │ │ └── utils/ │ │ │ ├── dom.test.ts │ │ │ ├── history.test.ts │ │ │ ├── request.test.ts │ │ │ └── url.test.ts │ │ ├── __web__/ │ │ │ ├── container.html │ │ │ ├── href.html │ │ │ ├── index.html │ │ │ ├── page.html │ │ │ ├── scripts/ │ │ │ │ ├── container.js │ │ │ │ ├── default.js │ │ │ │ ├── href.js │ │ │ │ ├── transitions/ │ │ │ │ │ └── hooks.js │ │ │ │ ├── views/ │ │ │ │ │ └── hooks.js │ │ │ │ └── views.js │ │ │ └── views.html │ │ ├── jest.config.js │ │ ├── package.json │ │ └── src/ │ │ ├── core.ts │ │ ├── defs/ │ │ │ ├── barba.ts │ │ │ ├── cache.ts │ │ │ ├── dom.ts │ │ │ ├── global.ts │ │ │ ├── headers.ts │ │ │ ├── history.ts │ │ │ ├── hooks.ts │ │ │ ├── ignore.ts │ │ │ ├── index.ts │ │ │ ├── is-promise.d.ts │ │ │ ├── prevent.ts │ │ │ ├── request.ts │ │ │ ├── rules.ts │ │ │ ├── schemas.ts │ │ │ ├── transition.ts │ │ │ ├── url.ts │ │ │ └── view.ts │ │ ├── hooks.ts │ │ ├── index.ts │ │ ├── modules/ │ │ │ ├── Cache.ts │ │ │ ├── Error.ts │ │ │ ├── Headers.ts │ │ │ ├── Ignore.ts │ │ │ ├── Logger.ts │ │ │ ├── Prevent.ts │ │ │ ├── Store.ts │ │ │ ├── Transitions.ts │ │ │ └── Views.ts │ │ ├── polyfills/ │ │ │ └── index.ts │ │ ├── schemas/ │ │ │ ├── attribute.ts │ │ │ └── page.ts │ │ ├── typings.ts │ │ └── utils/ │ │ ├── dom.ts │ │ ├── helpers.ts │ │ ├── history.ts │ │ ├── index.ts │ │ ├── request.ts │ │ ├── run-async.ts │ │ └── url.ts │ ├── css/ │ │ ├── .npmignore │ │ ├── AUTHORS │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __e2e__/ │ │ │ ├── default.spec.js │ │ │ ├── named.spec.js │ │ │ └── once.spec.js │ │ ├── __tests__/ │ │ │ ├── css.classes.test.ts │ │ │ ├── css.hooks.test.ts │ │ │ ├── css.init.test.ts │ │ │ ├── css.prefix.test.ts │ │ │ └── css.states.test.ts │ │ ├── __web__/ │ │ │ ├── index.html │ │ │ ├── named.html │ │ │ ├── once.html │ │ │ ├── page.html │ │ │ ├── scripts/ │ │ │ │ ├── default.js │ │ │ │ └── named.js │ │ │ └── styles/ │ │ │ ├── default.css │ │ │ ├── named.css │ │ │ └── once.css │ │ ├── jest.config.js │ │ ├── package.json │ │ └── src/ │ │ ├── css.ts │ │ ├── defs/ │ │ │ └── index.ts │ │ ├── index.ts │ │ └── typings.ts │ ├── prefetch/ │ │ ├── .npmignore │ │ ├── AUTHORS │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __e2e__/ │ │ │ └── prefetch.spec.js │ │ ├── __tests__/ │ │ │ └── prefetch.init.test.ts │ │ ├── __web__/ │ │ │ └── index.html │ │ ├── jest.config.js │ │ ├── package.json │ │ └── src/ │ │ ├── defs/ │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── polyfills/ │ │ │ ├── index.ts │ │ │ └── requestIdleCallback.ts │ │ ├── prefetch.ts │ │ └── typings.ts │ └── router/ │ ├── .npmignore │ ├── AUTHORS │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── __e2e__/ │ │ └── default.spec.js │ ├── __tests__/ │ │ └── router.test.ts │ ├── __web__/ │ │ ├── default.html │ │ ├── index.html │ │ ├── page.html │ │ └── scripts/ │ │ └── default.js │ ├── jest.config.js │ ├── package.json │ └── src/ │ ├── defs/ │ │ └── index.ts │ ├── index.ts │ ├── router.ts │ └── typings.ts ├── prettier.config.js ├── tsconfig.json ├── tslint.json └── typedoc.json
SYMBOL INDEX (303 symbols across 59 files)
FILE: cypress.config.ts
method setupNodeEvents (line 11) | setupNodeEvents(on, config) {
FILE: packages/core/__mocks__/barba.ts
function init (line 7) | function init(transitions: ITransitionPage[] = []): any {
FILE: packages/core/__tests__/core/core.go.test.ts
method leave (line 56) | leave() {}
method enter (line 56) | enter() {}
method stopPropagation (line 97) | stopPropagation() {}
method preventDefault (line 98) | preventDefault() {}
method stopPropagation (line 139) | stopPropagation() {}
method preventDefault (line 140) | preventDefault() {}
FILE: packages/core/__tests__/core/core.init.test.ts
function init (line 16) | function init() {
method requestError (line 104) | requestError() {
FILE: packages/core/__tests__/core/core.once.test.ts
method once (line 19) | once() {}
FILE: packages/core/__tests__/core/core.page.test.ts
method leave (line 21) | leave() {}
method enter (line 21) | enter() {}
method leave (line 124) | leave() {}
method enter (line 124) | enter() {}
method leave (line 137) | leave() {}
method enter (line 138) | enter() {}
method leave (line 153) | leave() {
FILE: packages/core/__tests__/core/core.plugin.test.ts
method install (line 11) | install() {}
method init (line 12) | init() {}
method install (line 17) | install() {}
method init (line 18) | init() {}
FILE: packages/core/__tests__/hooks/hooks.test.ts
type ICtx (line 74) | interface ICtx {
FILE: packages/core/__tests__/modules/store/store.check.test.ts
function runStrings (line 47) | function runStrings(
function runObject (line 67) | function runObject(
function runFunction (line 87) | function runFunction(
FILE: packages/core/__tests__/modules/store/store.resolve.once.test.ts
method custom (line 11) | custom({ current }) {
FILE: packages/core/__tests__/modules/store/store.resolve.page.test.ts
method enter (line 5) | enter() {}
method enter (line 6) | enter() {}
method enter (line 7) | enter() {}
method enter (line 8) | enter() {}
method enter (line 10) | enter() {}
method enter (line 14) | enter() {}
FILE: packages/core/__tests__/modules/store/store.update.test.ts
method once (line 18) | once() {}
method enter (line 24) | enter() {}
method once (line 30) | once() {}
method enter (line 30) | enter() {}
FILE: packages/core/__tests__/modules/transitions/transitions.async.test.ts
function doPage (line 29) | async function doPage(leave: any) {
method leaveCallback (line 55) | leaveCallback() {
FILE: packages/core/__tests__/modules/transitions/transitions.context.test.ts
method once (line 27) | once() {
FILE: packages/core/__tests__/modules/transitions/transitions.page.test.ts
method leave (line 233) | leave() {
method enter (line 260) | enter() {}
method leave (line 282) | leave() {}
method leave (line 305) | leave() {}
method enter (line 305) | enter() {}
method enter (line 341) | enter() {}
method enter (line 342) | enter() {}
method leave (line 343) | leave() {}
method enter (line 344) | enter() {}
FILE: packages/core/__tests__/modules/views.test.ts
method beforeEnter (line 125) | beforeEnter() {
FILE: packages/core/__web__/scripts/container.js
method leave (line 10) | leave() {}
method enter (line 11) | enter() {}
method leave (line 17) | leave() {}
method enter (line 18) | enter() {}
FILE: packages/core/__web__/scripts/href.js
method leave (line 10) | leave() {}
method enter (line 11) | enter() {}
FILE: packages/core/__web__/scripts/transitions/hooks.js
function append (line 12) | function append(str, prefix = '') {
function sleep (line 24) | function sleep() {
method beforeOnce (line 31) | beforeOnce() {
method once (line 35) | once() {
method afterOnce (line 39) | afterOnce() {
method before (line 43) | before() {
method beforeLeave (line 47) | beforeLeave() {
method leave (line 51) | leave() {
method afterLeave (line 55) | afterLeave() {
method beforeEnter (line 59) | beforeEnter() {
method enter (line 63) | enter() {
method afterEnter (line 67) | afterEnter() {
method after (line 71) | after() {
FILE: packages/core/__web__/scripts/views/hooks.js
function append (line 11) | function append(str, prefix = '') {
method beforeLeave (line 20) | beforeLeave() {
method afterLeave (line 23) | afterLeave() {
method beforeEnter (line 26) | beforeEnter() {
method afterEnter (line 29) | afterEnter() {
method beforeLeave (line 36) | beforeLeave() {
method afterLeave (line 39) | afterLeave() {
method beforeEnter (line 42) | beforeEnter() {
method afterEnter (line 45) | afterEnter() {
FILE: packages/core/src/core.ts
class Core (line 51) | class Core {
method use (line 112) | public use<T>(plugin: IBarbaPlugin<T>, options?: T): void {
method init (line 151) | public init(
method destroy (line 255) | public destroy(): void {
method data (line 263) | get data(): ITransitionData {
method wrapper (line 267) | get wrapper(): HTMLElement {
method force (line 274) | public force(href: string): void {
method go (line 291) | public go(
method once (line 339) | public async once(readyData: ITransitionData): Promise<void> {
method page (line 367) | public async page(
method onRequestError (line 447) | public onRequestError(trigger: Trigger, ...args: any): boolean {
method prefetch (line 473) | public prefetch(href: string) {
method _bind (line 503) | private _bind(): void {
method _unbind (line 516) | private _unbind(): void {
method _onLinkEnter (line 532) | private _onLinkEnter(e: LinkEvent): void {
method _onLinkClick (line 573) | private _onLinkClick(e: LinkEvent): void {
method _onStateChange (line 600) | private _onStateChange(e: PopStateEvent): void {
method _getLinkElement (line 610) | private _getLinkElement(e: LinkEvent): Link {
method _resetData (line 630) | private _resetData() {
FILE: packages/core/src/defs/barba.ts
type IBarbaOptions (line 19) | interface IBarbaOptions {
type IBarbaPlugin (line 46) | interface IBarbaPlugin<T> {
FILE: packages/core/src/defs/cache.ts
type ICacheData (line 7) | interface ICacheData {
type CacheRequest (line 14) | type CacheRequest = Promise<IResponse | void>;
type CacheAction (line 15) | type CacheAction = 'init' | 'enter' | 'click' | 'prefetch';
type CacheStatus (line 16) | type CacheStatus = 'pending' | 'fulfilled' | 'rejected';
type CacheTarget (line 17) | type CacheTarget = string;
FILE: packages/core/src/defs/dom.ts
type Link (line 5) | type Link = HTMLAnchorElement | SVGAElement;
type LinkEvent (line 6) | type LinkEvent = MouseEvent | TouchEvent;
type Scope (line 7) | type Scope = HTMLElement | HTMLDocument;
type Trigger (line 8) | type Trigger = Link | 'barba' | 'popstate' | 'back' | 'forward';
type Wrapper (line 9) | type Wrapper = HTMLElement | null;
type IDomSibling (line 11) | interface IDomSibling {
FILE: packages/core/src/defs/global.ts
type IGenericObject (line 5) | interface IGenericObject {
FILE: packages/core/src/defs/headers.ts
type HeaderList (line 5) | type HeaderList = Map<string, string>;
type IHeaderData (line 7) | interface IHeaderData {
FILE: packages/core/src/defs/history.ts
type HistoryAction (line 5) | type HistoryAction = 'push' | 'replace';
FILE: packages/core/src/defs/hooks.ts
type HooksBarba (line 6) | type HooksBarba =
type HooksOnce (line 15) | type HooksOnce = 'beforeOnce' | 'once' | 'afterOnce';
type HooksPage (line 17) | type HooksPage =
type HooksBefore (line 27) | type HooksBefore = 'beforeOnce' | 'beforeLeave' | 'beforeEnter';
type HooksAfter (line 28) | type HooksAfter = 'afterOnce' | 'afterLeave' | 'afterEnter';
type HooksTransition (line 30) | type HooksTransition = HooksOnce | HooksPage;
type HooksView (line 31) | type HooksView = HooksBefore | HooksAfter;
type HooksAll (line 32) | type HooksAll = HooksBarba | HooksTransition;
type HooksTransitionMap (line 35) | type HooksTransitionMap = { [key in HooksTransition]?: any };
type HookFunction (line 37) | type HookFunction = (
class HookMethods (line 42) | class HookMethods {
FILE: packages/core/src/defs/ignore.ts
type IgnoreOption (line 5) | type IgnoreOption = boolean | string | string[];
FILE: packages/core/src/defs/prevent.ts
type IPreventCheckData (line 15) | interface IPreventCheckData {
type PreventCheck (line 27) | type PreventCheck = (data: IPreventCheckData) => boolean;
FILE: packages/core/src/defs/request.ts
type IResponse (line 8) | interface IResponse {
type RequestError (line 13) | type RequestError = (
type RequestCustomError (line 24) | type RequestCustomError = (
type IXhrResponse (line 31) | interface IXhrResponse {
type RequestErrorOrResponse (line 36) | type RequestErrorOrResponse = Error | IXhrResponse;
FILE: packages/core/src/defs/rules.ts
type RuleName (line 5) | type RuleName =
type RuleType (line 10) | type RuleType = 'strings' | 'object' | 'function';
type IRule (line 12) | interface IRule {
type IRules (line 17) | interface IRules {
FILE: packages/core/src/defs/schemas.ts
type IRouteResolved (line 5) | interface IRouteResolved {
type SchemaAttributeValues (line 11) | type SchemaAttributeValues =
type ISchemaAttribute (line 29) | interface ISchemaAttribute {
type ISchemaPage (line 51) | interface ISchemaPage {
FILE: packages/core/src/defs/transition.ts
type ITransitionData (line 10) | interface ITransitionData {
type ITransitionFilters (line 18) | interface ITransitionFilters {
type ITransitionRules (line 24) | interface ITransitionRules {
type ITransitionPage (line 31) | interface ITransitionPage extends ITransitionRules {
type ITransitionOnce (line 51) | interface ITransitionOnce extends ITransitionPage {
FILE: packages/core/src/defs/url.ts
type IUrlBase (line 8) | interface IUrlBase {
type IUrlFull (line 15) | interface IUrlFull extends IUrlBase {
FILE: packages/core/src/defs/view.ts
type IViewData (line 8) | interface IViewData {
type IView (line 14) | interface IView {
FILE: packages/core/src/hooks.ts
type IHookInfos (line 27) | interface IHookInfos {
class Hooks (line 32) | class Hooks extends HookMethods {
method constructor (line 73) | constructor() {
method init (line 78) | public init() {
method do (line 102) | public do(name: HooksAll, ...args: any): Promise<any> {
method clear (line 121) | public clear(): void {
method help (line 132) | public help(): void {
FILE: packages/core/src/modules/Cache.ts
class Cache (line 17) | class Cache extends Ignore {
method constructor (line 20) | constructor(ignore: IgnoreOption) {
method set (line 27) | public set(
method get (line 52) | public get(href: string): ICacheData {
method getRequest (line 59) | public getRequest(href: string): CacheRequest {
method getAction (line 66) | public getAction(href: string): CacheAction {
method getStatus (line 73) | public getStatus(href: string): CacheStatus {
method getTarget (line 80) | public getTarget(href: string): CacheTarget {
method has (line 87) | public has(href: string): boolean {
method delete (line 98) | public delete(href: string): boolean {
method update (line 105) | public update(href: string, data: ICacheData): ICacheData {
FILE: packages/core/src/modules/Error.ts
class BarbaError (line 2) | class BarbaError extends Error {
method constructor (line 4) | constructor(
FILE: packages/core/src/modules/Headers.ts
class Headers (line 15) | class Headers {
method set (line 21) | public set(name: string, value: string): IHeaderData {
method get (line 32) | public get(name: string): string {
method all (line 39) | public all(): HeaderList {
method has (line 46) | public has(name: string): boolean {
method delete (line 53) | public delete(name: string): boolean {
method clear (line 60) | public clear(): void {
FILE: packages/core/src/modules/Ignore.ts
class Ignore (line 21) | class Ignore {
method constructor (line 25) | constructor(ignore: IgnoreOption) {
method checkHref (line 35) | public checkHref(href: string): boolean {
FILE: packages/core/src/modules/Logger.ts
type LogLevels (line 23) | enum LogLevels {
class Logger (line 36) | class Logger {
method getLevel (line 40) | public static getLevel(): number {
method setLevel (line 47) | public static setLevel(name: keyof typeof LogLevels): number {
method constructor (line 61) | constructor(source: string) {
method error (line 75) | public error(...objects: any[]): void {
method warn (line 82) | public warn(...objects: any[]): void {
method info (line 89) | public info(...objects: any[]): void {
method debug (line 96) | public debug(...objects: any[]): void {
method _log (line 103) | private _log(fn: () => void, level: number, objects: any[]): void {
FILE: packages/core/src/modules/Prevent.ts
class Prevent (line 95) | class Prevent extends Ignore {
method constructor (line 99) | constructor(ignore: IgnoreOption) {
method init (line 104) | public init(): void {
method add (line 120) | public add(name: string, check: PreventCheck, suite: boolean = true): ...
method run (line 128) | public run(name: string, el: Link, event: Event, href: string): boolean {
method checkLink (line 139) | public checkLink(el: Link, event: Event, href: string): boolean {
FILE: packages/core/src/modules/Store.ts
class Store (line 29) | class Store {
method constructor (line 65) | constructor(transitions: ITransitionPage[] = []) {
method add (line 77) | public add(type: 'rule' | 'transition', data: any): void {
method resolve (line 96) | public resolve(
method update (line 183) | public update(): void {
method _check (line 211) | private _check(
method _calculatePriority (line 304) | private _calculatePriority(
method _addPriority (line 329) | private _addPriority(t: ITransitionPage): ITransitionPage {
FILE: packages/core/src/modules/Transitions.ts
class Transitions (line 34) | class Transitions {
method constructor (line 39) | constructor(transitions: ITransitionPage[] = []) {
method get (line 48) | public get(
method isRunning (line 58) | get isRunning(): boolean {
method isRunning (line 61) | set isRunning(status: boolean) {
method hasOnce (line 68) | get hasOnce(): boolean {
method hasSelf (line 75) | get hasSelf(): boolean {
method shouldWait (line 87) | get shouldWait(): boolean {
method doOnce (line 96) | public async doOnce({
method doPage (line 146) | public async doPage({
method once (line 270) | public async once(data: ITransitionData, t: ITransitionOnce): Promise<...
method leave (line 279) | public async leave(data: ITransitionData, t: ITransitionPage): Promise...
method enter (line 288) | public async enter(
method add (line 303) | public async add(data: ITransitionData, wrapper: Wrapper): Promise<voi...
method remove (line 311) | public async remove(data: ITransitionData): Promise<void> {
method _isTransitionError (line 316) | private _isTransitionError(error: any) {
method _doAsyncHook (line 333) | private async _doAsyncHook(
FILE: packages/core/src/modules/Views.ts
type Hook (line 19) | type Hook = (data: IViewData) => Promise<void>;
class Views (line 21) | class Views {
method constructor (line 39) | constructor(views: IView[]) {
method _createHook (line 62) | private _createHook(name: HooksView): Hook {
FILE: packages/core/src/utils/dom.ts
class Dom (line 22) | class Dom {
method toString (line 34) | public toString(el: HTMLElement): string {
method toDocument (line 43) | public toDocument(htmlString: string): HTMLDocument {
method toElement (line 57) | public toElement(htmlString: string): HTMLDivElement {
method getHtml (line 67) | public getHtml(doc: HTMLDocument = document): string {
method getWrapper (line 81) | public getWrapper(scope: Scope = document): Wrapper {
method getContainer (line 90) | public getContainer(scope: Scope = document): HTMLElement | null {
method removeContainer (line 99) | public removeContainer(container: HTMLElement) {
method addContainer (line 109) | public addContainer(container: HTMLElement, wrapper: HTMLElement) {
method getSibling (line 126) | public getSibling(): IDomSibling {
method getNamespace (line 133) | public getNamespace(scope: Scope = document): string | null {
method getHref (line 146) | public getHref(el: Link): string | null {
method resolveUrl (line 173) | public resolveUrl(...urls: string[]) {
method _insertAfter (line 207) | private _insertAfter(newNode: Node, referenceNode: Node) {
method _updateSibling (line 214) | private _updateSibling(container: HTMLElement): IDomSibling {
FILE: packages/core/src/utils/history.ts
type IHistoryItem (line 22) | interface IHistoryItem {
type ICoords (line 32) | interface ICoords {
type IStateItem (line 44) | interface IStateItem {
class History (line 55) | class History {
method init (line 63) | public init(url: string, ns: string): void {
method change (line 88) | public change(
method add (line 116) | public add(url: string, trigger: Trigger, action?: HistoryAction, data...
method store (line 163) | public store(data: object, i?: number): void {
method update (line 189) | public update(data: any, i?: number): void {
method remove (line 203) | public remove(i?: number): void {
method clear (line 216) | public clear(): void {
method replace (line 224) | public replace(newStates: IStateItem[]): void {
method get (line 231) | public get(index: number): IStateItem {
method set (line 238) | public set(i: number, state: IStateItem) {
method current (line 245) | get current(): IStateItem {
method previous (line 252) | get previous(): IStateItem | null {
method size (line 259) | get size(): number {
method _getAction (line 266) | private _getAction(trigger: Trigger): HistoryAction {
method _getDirection (line 284) | private _getDirection(diff: number): Trigger {
FILE: packages/core/src/utils/request.ts
function request (line 26) | function request(
FILE: packages/core/src/utils/run-async.ts
function runAsync (line 5) | function runAsync(
FILE: packages/css/__tests__/css.prefix.test.ts
method once (line 19) | once() {}
method leave (line 20) | leave() {}
method enter (line 21) | enter() {}
FILE: packages/css/src/css.ts
class Css (line 29) | class Css implements IBarbaPlugin<{}> {
method install (line 45) | public install(barba: Core) {
method init (line 57) | public init() {
method start (line 89) | public async start(container: HTMLElement, kind: string): Promise<void> {
method next (line 101) | public async next(container: HTMLElement, kind: string): Promise<any> {
method end (line 127) | public async end(container: HTMLElement, kind: string): Promise<void> {
method add (line 137) | public add(el: HTMLElement, step: string): void {
method remove (line 144) | public remove(el: HTMLElement, step: string): void {
method _getPrefix (line 151) | private _getPrefix(data: ITransitionData, t: ITransitionPage): void {
method _checkTransition (line 158) | private _checkTransition(container: HTMLElement) {
method _beforeOnce (line 166) | private _beforeOnce(data: ITransitionData): Promise<void> {
method _once (line 173) | private async _once(
method _afterOnce (line 185) | private _afterOnce(data: ITransitionData): Promise<void> {
method _beforeLeave (line 192) | private _beforeLeave(data: ITransitionData): Promise<void> {
method _leave (line 199) | private async _leave(
method _afterLeave (line 211) | private _afterLeave(data: ITransitionData): Promise<void> {
method _beforeEnter (line 223) | private _beforeEnter(data: ITransitionData): Promise<void> {
method _enter (line 230) | private async _enter(
method _afterEnter (line 242) | private _afterEnter(data: ITransitionData): Promise<void> {
FILE: packages/css/src/defs/index.ts
type CssKinds (line 5) | type CssKinds = 'once' | 'leave' | 'enter';
type ICssCallbacks (line 6) | interface ICssCallbacks {
FILE: packages/prefetch/__tests__/prefetch.init.test.ts
method observe (line 17) | public observe() {}
method unobserve (line 18) | public unobserve() {}
FILE: packages/prefetch/src/defs/index.ts
type IPrefetchOptions (line 5) | interface IPrefetchOptions {
FILE: packages/prefetch/src/prefetch.ts
class Prefetch (line 22) | class Prefetch implements IBarbaPlugin<IPrefetchOptions> {
method install (line 37) | public install(
method init (line 52) | public init() {
method observe (line 116) | public observe(): void {
FILE: packages/router/__web__/scripts/default.js
function append (line 21) | function append(str, prefix = '') {
FILE: packages/router/src/defs/index.ts
type IRoute (line 5) | interface IRoute {
type IRouteParsed (line 9) | interface IRouteParsed {
type IRouteResolved (line 14) | interface IRouteResolved {
type IRouteByName (line 18) | interface IRouteByName {
type IRouterOptions (line 21) | interface IRouterOptions {
FILE: packages/router/src/router.ts
class Router (line 24) | class Router implements IBarbaPlugin<IRouterOptions> {
method install (line 36) | public install(barba: Core, { routes = [] }: IRouterOptions = {}) {
method init (line 65) | public init() {
method resolveUrl (line 82) | public resolveUrl(url: string): IRouteResolved | null {
method resolveRoutes (line 114) | public resolveRoutes(data: ITransitionData): void {
Condensed preview — 210 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (393K chars).
[
{
"path": ".all-contributorsrc",
"chars": 18810,
"preview": "{\n \"projectName\": \"barba\",\n \"projectOwner\": \"barbajs\",\n \"repoType\": \"github\",\n \"repoHost\": \"https://github.com\",\n \""
},
{
"path": ".circleci/config.yml",
"chars": 3132,
"preview": "version: 2\n\ndefaults: &defaults\n working_directory: ~/repo\n docker:\n - image: cimg/node:20.4\n # Not working: Job \\"
},
{
"path": ".editorconfig",
"chars": 187,
"preview": "root = true\n\n[*]\nindent_style = space\nindent_size = 2\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newli"
},
{
"path": ".eslintrc.js",
"chars": 5614,
"preview": "module.exports = {\n env: {\n browser: true,\n commonjs: true,\n es6: true,\n node: true,\n 'cypress/globals':"
},
{
"path": ".github/CODE_OF_CONDUCT.md",
"chars": 3346,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": ".github/CONTRIBUTING.md",
"chars": 1070,
"preview": "# Contributing\n\nThis project uses:\n\n- [TypeScript](http://www.typescriptlang.org/)\n- [Lerna](https://lerna.js.org/)\n- [C"
},
{
"path": ".github/FUNDING.yml",
"chars": 70,
"preview": "# These are supported funding model platforms\n\ngithub: xavierfoucrier\n"
},
{
"path": ".github/ISSUE_TEMPLATE/bug-report.yml",
"chars": 1452,
"preview": "name: \"🐛 Bug report\"\ndescription: \"Report an issue with BarbaJS\"\ntitle: \"...\"\nlabels:\n - bug\nbody:\n- type: markdown\n a"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 437,
"preview": "contact_links:\n - name: ✨ Official BarbaJS website\n url: https://barba.js.org/\n about: New to BarbaJS? Have a loo"
},
{
"path": ".github/stale.yml",
"chars": 684,
"preview": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 60\n# Number of days of inactivity before a "
},
{
"path": ".gitignore",
"chars": 2607,
"preview": "# Created by https://www.gitignore.io/api/node,macos,linux,windows,visualstudiocode\n\n### Linux ###\n*~\n\n# temporary files"
},
{
"path": ".lintstagedrc",
"chars": 97,
"preview": "{\n \"src/**/*.ts\": [\"prettier --write\", \"npm run lint\"],\n \"*.{json,md}\": [\"prettier --write\"]\n}\n"
},
{
"path": ".markdownlint.json",
"chars": 291,
"preview": "{\n \"default\": true,\n \"fenced-code-language\": false,\n \"first-line-h1\": false,\n \"line-length\": false,\n \"no-inline-htm"
},
{
"path": ".vscode/settings.json",
"chars": 62,
"preview": "{\n \"editor.formatOnSave\": true,\n \"sasslint.enable\": false\n}\n"
},
{
"path": "AUTHORS",
"chars": 190,
"preview": "Luigi De Rosa <lurukee@gmail.com> (https://luruke.com/)\nThierry Michel <thmichel@gmail.com> (https://www.epic.net/)\nXavi"
},
{
"path": "CI.md",
"chars": 1103,
"preview": "# CI\n\n## @snitch\n\n```\nlanguage: node_js\nnode_js:\n - \"8\"\nafter_success: 'npm run coverage'\n```\n\n## sassy-beam\n\n`.travis."
},
{
"path": "LICENSE.md",
"chars": 1103,
"preview": "MIT License\n\nCopyright (c) 2024 Luigi De Rosa, Thierry Michel, Xavier Foucrier\n\nPermission is hereby granted, free of ch"
},
{
"path": "NOTES.md",
"chars": 488,
"preview": "# Notes\n\n## Lerna/npm publish\n\n- `yarn run release`\n- `yarn run release:next`\n\n### Beta `publish`\n\n```sh\nyarn test\nlerna"
},
{
"path": "README.md",
"chars": 34362,
"preview": "# barba.js –  [: 🔖 publish\",\n "
},
{
"path": "package.json",
"chars": 3051,
"preview": "{\n \"name\": \"root\",\n \"private\": true,\n \"devDependencies\": {\n \"@commitlint/cli\": \"^19.3.0\",\n \"@commitlint/config-"
},
{
"path": "packages/core/.npmignore",
"chars": 125,
"preview": "### Custom ###\n/__e2e__\n/__mocks__\n/__tests__\n/__web__\n/jest.config.js\n/mangle.json\n/*.md\n/.rts2*\n!/README.md\n!/CHANGELO"
},
{
"path": "packages/core/AUTHORS",
"chars": 190,
"preview": "Luigi De Rosa <lurukee@gmail.com> (https://luruke.com/)\nThierry Michel <thmichel@gmail.com> (https://www.epic.net/)\nXavi"
},
{
"path": "packages/core/CHANGELOG.md",
"chars": 23550,
"preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
},
{
"path": "packages/core/LICENSE",
"chars": 1103,
"preview": "MIT License\n\nCopyright (c) 2024 Luigi De Rosa, Thierry Michel, Xavier Foucrier\n\nPermission is hereby granted, free of ch"
},
{
"path": "packages/core/README.md",
"chars": 470,
"preview": "# @barba/core\n\n[](https://www.npmjs.com/packag"
},
{
"path": "packages/core/__e2e__/container.spec.js",
"chars": 1040,
"preview": "/* eslint-disable cypress/no-unnecessary-waiting */\ndescribe('Transition', () => {\n it('adds container at the right pla"
},
{
"path": "packages/core/__e2e__/default.spec.js",
"chars": 309,
"preview": "/* eslint-disable cypress/no-unnecessary-waiting */\ndescribe('Transition', () => {\n it('works', () => {\n cy.prepare("
},
{
"path": "packages/core/__e2e__/hooks.spec.js",
"chars": 1808,
"preview": "/* eslint-disable no-mixed-operators, cypress/no-unnecessary-waiting */\nconst onceHooks = [\n 'global:beforeEnter',\n //"
},
{
"path": "packages/core/__e2e__/href.spec.js",
"chars": 2061,
"preview": "/* eslint-disable cypress/no-unnecessary-waiting */\ndescribe('Transition', () => {\n const origin = 'http://localhost:81"
},
{
"path": "packages/core/__e2e__/views.spec.js",
"chars": 1308,
"preview": "/* eslint-disable no-mixed-operators, cypress/no-unnecessary-waiting */\nconst loadHooks = ['beforeEnter', 'afterEnter'];"
},
{
"path": "packages/core/__mocks__/barba.ts",
"chars": 1000,
"preview": "import barba from '../src';\nimport { ITransitionPage } from '../src/defs';\n\n/**\n * Init barba with basic DOM for testing"
},
{
"path": "packages/core/__mocks__/transitions.ts",
"chars": 1699,
"preview": "import { ITransitionPage } from '../src/defs';\n\nconst namespace = 'n';\nconst route = 'r';\nconst custom = () => true;\ncon"
},
{
"path": "packages/core/__tests__/core/core.click.test.ts",
"chars": 1067,
"preview": "import { init } from '../../__mocks__/barba';\nimport barba from '../../src';\n\nconst { link, span, click } = init();\n\n// "
},
{
"path": "packages/core/__tests__/core/core.enter.test.ts",
"chars": 2499,
"preview": "import waitForExpect from 'wait-for-expect';\nimport xhrMock from 'xhr-mock';\nimport { init } from '../../__mocks__/barba"
},
{
"path": "packages/core/__tests__/core/core.force.test.ts",
"chars": 296,
"preview": "import barba from '../../src';\n\nit('force url change', () => {\n Object.defineProperty(window, 'location', {\n writabl"
},
{
"path": "packages/core/__tests__/core/core.go.test.ts",
"chars": 3478,
"preview": "/* tslint:disable:no-empty no-string-literal */\nimport { init } from '../../__mocks__/barba';\nimport barba from '../../s"
},
{
"path": "packages/core/__tests__/core/core.init.test.ts",
"chars": 2903,
"preview": "/* tslint:disable:no-string-literal */\nimport barba from '../../src';\nimport { PreventCheck } from '../../src/defs';\n\nco"
},
{
"path": "packages/core/__tests__/core/core.logger.test.ts",
"chars": 436,
"preview": "import { init } from '../../__mocks__/barba';\nimport barba from '../../src';\nimport { Logger } from '../../src/modules/L"
},
{
"path": "packages/core/__tests__/core/core.once.test.ts",
"chars": 597,
"preview": "/* tslint:disable:no-empty */\nimport { init } from '../../__mocks__/barba';\nimport barba from '../../src';\nimport { ITra"
},
{
"path": "packages/core/__tests__/core/core.page.test.ts",
"chars": 5018,
"preview": "/* tslint:disable:no-empty no-string-literal */\nimport xhrMock from 'xhr-mock';\nimport { init } from '../../__mocks__/ba"
},
{
"path": "packages/core/__tests__/core/core.plugin.test.ts",
"chars": 1334,
"preview": "/* tslint:disable:no-empty */\nimport { init } from '../../__mocks__/barba';\nimport barba from '../../src';\nimport { IBar"
},
{
"path": "packages/core/__tests__/core/core.popstate.test.ts",
"chars": 383,
"preview": "/* tslint:disable:no-empty no-string-literal */\nimport { init } from '../../__mocks__/barba';\nimport barba from '../../s"
},
{
"path": "packages/core/__tests__/core/core.prefetch.test.ts",
"chars": 1222,
"preview": "import waitForExpect from 'wait-for-expect';\nimport xhrMock from 'xhr-mock';\nimport { init } from '../../__mocks__/barba"
},
{
"path": "packages/core/__tests__/core/core.requestError.test.ts",
"chars": 1304,
"preview": "/* tslint:disable:no-string-literal */\nimport { init } from '../../__mocks__/barba';\nimport barba from '../../src';\n\nini"
},
{
"path": "packages/core/__tests__/core/core.test.ts",
"chars": 746,
"preview": "import { init } from '../../__mocks__/barba';\nimport { version } from '../../package.json';\nimport barba from '../../src"
},
{
"path": "packages/core/__tests__/hooks/hooks.test.ts",
"chars": 2564,
"preview": "import { HooksAll } from '../../src/defs';\nimport { hooks } from '../../src/hooks';\n\nconst [hookName] = hooks.all;\n\nafte"
},
{
"path": "packages/core/__tests__/modules/cache.test.ts",
"chars": 1282,
"preview": "import { Cache } from '../../src/modules/Cache';\n\nconst cache = new Cache(false);\n\nconst key = 'key';\nconst request = Pr"
},
{
"path": "packages/core/__tests__/modules/error.test.ts",
"chars": 507,
"preview": "import { BarbaError } from '../../src/modules/Error';\n\nconst err = new Error('Test error');\n\nit('has defaults', () => {\n"
},
{
"path": "packages/core/__tests__/modules/headers.test.ts",
"chars": 546,
"preview": "import { Headers } from '../../src/modules/Headers';\n\nconst headers = new Headers();\n\nconst name = 'header-name';\nconst "
},
{
"path": "packages/core/__tests__/modules/ignore.test.ts",
"chars": 784,
"preview": "import { Ignore } from '../../src/modules/Ignore';\n\nlet ignore: Ignore;\nconst url = 'http://localhost/';\nconst url2 = 'h"
},
{
"path": "packages/core/__tests__/modules/logger.test.ts",
"chars": 1968,
"preview": "/* tslint:disable:no-string-literal */\nimport { Logger, LogLevels } from '../../src/modules/Logger';\n\nlet logger: Logger"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.blank.test.ts",
"chars": 843,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.corsDomain.test.ts",
"chars": 868,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.corsPort.test.ts",
"chars": 700,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.download.test.ts",
"chars": 672,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.exists.test.ts",
"chars": 933,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.newTab.test.ts",
"chars": 1373,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.preventAll.test.ts",
"chars": 751,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.preventSelf.test.ts",
"chars": 844,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.sameUrl.test.ts",
"chars": 541,
"preview": "import { IPreventCheckData, PreventCheck } from '../../../src/defs';\nimport { Prevent } from '../../../src/modules/Preve"
},
{
"path": "packages/core/__tests__/modules/prevent/prevent.test.ts",
"chars": 250,
"preview": "import { Prevent } from '../../../src/modules/Prevent';\n\nconst prevent = new Prevent(false);\n\nit('adds test', () => {\n "
},
{
"path": "packages/core/__tests__/modules/store/store.add.test.ts",
"chars": 878,
"preview": "/* tslint:disable:no-string-literal */\nimport { Store } from '../../../src/modules/Store';\n\nlet store: Store;\n\nbeforeEac"
},
{
"path": "packages/core/__tests__/modules/store/store.addPriority.test.ts",
"chars": 2555,
"preview": "/* tslint:disable:no-string-literal */\nimport { IRule, ITransitionPage } from '../../../src/defs';\nimport { Store } from"
},
{
"path": "packages/core/__tests__/modules/store/store.check.test.ts",
"chars": 7829,
"preview": "/* tslint:disable:no-string-literal */\nimport {\n IRule,\n ISchemaPage,\n ITransitionData,\n ITransitionPage,\n} from '.."
},
{
"path": "packages/core/__tests__/modules/store/store.log.test.ts",
"chars": 436,
"preview": "import { Logger } from '../../../src/modules/Logger';\nimport { Store } from '../../../src/modules/Store';\nimport { schem"
},
{
"path": "packages/core/__tests__/modules/store/store.resolve.once.test.ts",
"chars": 1417,
"preview": "import { ITransitionData, ITransitionOnce } from '../../../src/defs';\nimport { Store } from '../../../src/modules/Store'"
},
{
"path": "packages/core/__tests__/modules/store/store.resolve.page.test.ts",
"chars": 2045,
"preview": "/* tslint:disable:no-empty */\nimport { ITransitionData } from '../../../src/defs';\nimport { Store } from '../../../src/m"
},
{
"path": "packages/core/__tests__/modules/store/store.test.ts",
"chars": 304,
"preview": "import { Store } from '../../../src/modules/Store';\n\nlet store: Store;\n\nit('has defaults', () => {\n store = new Store(["
},
{
"path": "packages/core/__tests__/modules/store/store.update.sort.test.ts",
"chars": 660,
"preview": "import shuffle from 'lodash/shuffle';\nimport transitions from '../../../__mocks__/transitions';\nimport { Store } from '."
},
{
"path": "packages/core/__tests__/modules/store/store.update.test.ts",
"chars": 767,
"preview": "/* tslint:disable:no-empty */\nimport { Store } from '../../../src/modules/Store';\n\nlet store: Store;\nlet nb: number;\n\nbe"
},
{
"path": "packages/core/__tests__/modules/transitions/transitions.async.test.ts",
"chars": 1579,
"preview": "import { ISchemaPage, ITransitionData } from '../../../src/defs';\nimport { hooks } from '../../../src/hooks';\nimport { T"
},
{
"path": "packages/core/__tests__/modules/transitions/transitions.context.test.ts",
"chars": 735,
"preview": "import {\n ISchemaPage,\n ITransitionData,\n ITransitionOnce,\n} from '../../../src/defs';\nimport { Logger } from '../../"
},
{
"path": "packages/core/__tests__/modules/transitions/transitions.get.test.ts",
"chars": 585,
"preview": "import { ISchemaPage, ITransitionData } from '../../../src/defs';\nimport { Transitions } from '../../../src/modules/Tran"
},
{
"path": "packages/core/__tests__/modules/transitions/transitions.once.test.ts",
"chars": 2375,
"preview": "import {\n ISchemaPage,\n ITransitionData,\n ITransitionOnce,\n} from '../../../src/defs';\nimport { hooks } from '../../."
},
{
"path": "packages/core/__tests__/modules/transitions/transitions.page.test.ts",
"chars": 9066,
"preview": "/* tslint:disable:no-empty */\nimport { init } from '../../../__mocks__/barba';\nimport barba from '../../../src';\nimport "
},
{
"path": "packages/core/__tests__/modules/transitions/transitions.test.ts",
"chars": 721,
"preview": "import { Transitions } from '../../../src/modules/Transitions';\n\nlet transitions: Transitions;\n\nit('has defaults', () =>"
},
{
"path": "packages/core/__tests__/modules/views.test.ts",
"chars": 3657,
"preview": "import { IView } from '../../src/defs';\nimport { hooks } from '../../src/hooks';\nimport { Views } from '../../src/module"
},
{
"path": "packages/core/__tests__/utils/dom.test.ts",
"chars": 7345,
"preview": "/* tslint:disable:no-string-literal */\nimport { schemaAttribute } from '../../src/schemas/attribute';\nimport { dom } fro"
},
{
"path": "packages/core/__tests__/utils/history.test.ts",
"chars": 5188,
"preview": "import { history } from '../../src/utils/history';\n\nconst first = {\n data: {},\n ns: 'ns1',\n scroll: {\n x: 0,\n y"
},
{
"path": "packages/core/__tests__/utils/request.test.ts",
"chars": 3592,
"preview": "import xhrMock from 'xhr-mock';\nimport { init } from '../../__mocks__/barba';\nimport barba from '../../src';\nimport { IR"
},
{
"path": "packages/core/__tests__/utils/url.test.ts",
"chars": 2499,
"preview": "/* global jsdom */\nimport { url } from '../../src/utils';\n\nit('get href', () => {\n const href = url.getHref();\n\n expec"
},
{
"path": "packages/core/__web__/container.html",
"chars": 794,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width,"
},
{
"path": "packages/core/__web__/href.html",
"chars": 911,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width,"
},
{
"path": "packages/core/__web__/index.html",
"chars": 867,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "packages/core/__web__/page.html",
"chars": 571,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "packages/core/__web__/scripts/container.js",
"chars": 367,
"preview": "/* eslint-disable no-empty-function */\nconsole.info('🚀 Barba e2e');\n\nconst { barba } = window;\n\nbarba.init({\n debug: tr"
},
{
"path": "packages/core/__web__/scripts/default.js",
"chars": 183,
"preview": "console.info('🚀 Barba e2e');\nimport { hooks, hooksSync } from './transitions/hooks.js';\n\nconst { barba } = window;\n\nbarb"
},
{
"path": "packages/core/__web__/scripts/href.js",
"chars": 199,
"preview": "/* eslint-disable no-empty-function */\nconsole.info('🚀 Barba e2e');\n\nconst { barba } = window;\n\nbarba.init({\n debug: tr"
},
{
"path": "packages/core/__web__/scripts/transitions/hooks.js",
"chars": 2317,
"preview": "/* eslint-disable newline-before-return */\nconst { barba } = window;\nconst list = document.querySelector('[data-test=\"ho"
},
{
"path": "packages/core/__web__/scripts/views/hooks.js",
"chars": 870,
"preview": "/* eslint-disable newline-before-return */\nconst list = document.querySelector('[data-test=\"hooks-list\"]');\n\n/**\n * Appe"
},
{
"path": "packages/core/__web__/scripts/views.js",
"chars": 774,
"preview": "console.info('🚀 Barba e2e');\nimport { home, page } from './views/hooks.js';\n\nconst { barba } = window;\n\n// const list = "
},
{
"path": "packages/core/__web__/views.html",
"chars": 795,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "packages/core/jest.config.js",
"chars": 88,
"preview": "const jestBase = require('../../jest.config.js');\n\nmodule.exports = {\n ...jestBase,\n};\n"
},
{
"path": "packages/core/package.json",
"chars": 1508,
"preview": "{\n \"name\": \"@barba/core\",\n \"version\": \"2.10.3\",\n \"description\": \"Create badass, fluid and smooth transition between y"
},
{
"path": "packages/core/src/core.ts",
"chars": 15635,
"preview": "/**\n * @barba/core\n * <br><br>\n * ## Barba core object\n *\n * Main methods:\n *\n * - `.init()` for initialization with opt"
},
{
"path": "packages/core/src/defs/barba.ts",
"chars": 1311,
"preview": "/**\n * @module typings/core\n */\n\n// Core\nimport { Core } from '../core';\n// Modules\nimport { LogLevels } from '../module"
},
{
"path": "packages/core/src/defs/cache.ts",
"chars": 421,
"preview": "/**\n * @module typings/core\n */\n\nimport { IResponse } from './index';\n\nexport interface ICacheData {\n action?: CacheAct"
},
{
"path": "packages/core/src/defs/dom.ts",
"chars": 389,
"preview": "/**\n * @module typings/core\n */\n\nexport type Link = HTMLAnchorElement | SVGAElement;\nexport type LinkEvent = MouseEvent "
},
{
"path": "packages/core/src/defs/global.ts",
"chars": 94,
"preview": "/**\n * @module typings/core\n */\n\nexport interface IGenericObject {\n [key: string]: string;\n}\n"
},
{
"path": "packages/core/src/defs/headers.ts",
"chars": 148,
"preview": "/**\n * @module typings/core\n */\n\nexport type HeaderList = Map<string, string>;\n\nexport interface IHeaderData {\n name?: "
},
{
"path": "packages/core/src/defs/history.ts",
"chars": 84,
"preview": "/**\n * @module typings/history\n */\n\nexport type HistoryAction = 'push' | 'replace';\n"
},
{
"path": "packages/core/src/defs/hooks.ts",
"chars": 1470,
"preview": "/**\n * @module typings/core\n */\nimport { ITransitionData, ITransitionPage, IViewData } from './index';\n\nexport type Hook"
},
{
"path": "packages/core/src/defs/ignore.ts",
"chars": 89,
"preview": "/**\n * @module typings/core\n */\n\nexport type IgnoreOption = boolean | string | string[];\n"
},
{
"path": "packages/core/src/defs/index.ts",
"chars": 414,
"preview": "export * from './barba';\n// export * from './core';\nexport * from './headers';\nexport * from './cache';\nexport * from '."
},
{
"path": "packages/core/src/defs/is-promise.d.ts",
"chars": 29,
"preview": "declare module 'is-promise';\n"
},
{
"path": "packages/core/src/defs/prevent.ts",
"chars": 501,
"preview": "/**\n * @module typings/core\n */\n\n// Definitions\nimport { Link } from './index';\n\n/**\n * Available data for all prevent c"
},
{
"path": "packages/core/src/defs/request.ts",
"chars": 650,
"preview": "/**\n * @module typings/core\n */\n\n// Definitions\nimport { IUrlFull, Trigger } from './index';\n\nexport interface IResponse"
},
{
"path": "packages/core/src/defs/rules.ts",
"chars": 340,
"preview": "/**\n * @module typings/core\n */\n\nexport type RuleName =\n | IRules['strings']\n | IRules['object']\n | IRules['function'"
},
{
"path": "packages/core/src/defs/schemas.ts",
"chars": 1208,
"preview": "/**\n * @module typings/core\n */\n\ninterface IRouteResolved {\n name: string;\n params: any;\n}\nimport { IUrlFull } from '."
},
{
"path": "packages/core/src/defs/transition.ts",
"chars": 1361,
"preview": "/**\n * @module typings/core\n */\n\n// Definitions\nimport { LinkEvent } from '../defs';\nimport { ISchemaPage, Trigger } fro"
},
{
"path": "packages/core/src/defs/url.ts",
"chars": 294,
"preview": "/**\n * @module typings/core\n */\n\n// Definitions\nimport { IGenericObject } from './index';\n\nexport interface IUrlBase {\n "
},
{
"path": "packages/core/src/defs/view.ts",
"chars": 488,
"preview": "/**\n * @module typings/core\n */\n\n// Definitions\nimport { ISchemaPage, Trigger } from './index';\n\nexport interface IViewD"
},
{
"path": "packages/core/src/hooks.ts",
"chars": 2867,
"preview": "/**\n * @barba/core/modules/hooks\n * <br><br>\n * ## Hooks manager.\n *\n * - Register and trigger hooks\n *\n * Hooks can be "
},
{
"path": "packages/core/src/index.ts",
"chars": 66,
"preview": "import * as t from './typings';\nexport { default } from './core';\n"
},
{
"path": "packages/core/src/modules/Cache.ts",
"chars": 2066,
"preview": "/**\n * @barba/core/modules/cache\n * <br><br>\n * ## Cache for storing URL / HTML.\n *\n * @module core/modules/cache\n * @pr"
},
{
"path": "packages/core/src/modules/Error.ts",
"chars": 618,
"preview": "// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\nexport class BarbaError extend"
},
{
"path": "packages/core/src/modules/Headers.ts",
"chars": 970,
"preview": "/**\n * @barba/core/modules/headers\n * <br><br>\n * ## Manage request Headers.\n *\n * @module core/modules/headers\n * @pref"
},
{
"path": "packages/core/src/modules/Ignore.ts",
"chars": 911,
"preview": "/**\n * @barba/core/modules/ignore\n * <br><br>\n * ## Manage ignore options.\n *\n * - cache\n * - prefetch\n *\n * @module cor"
},
{
"path": "packages/core/src/modules/Logger.ts",
"chars": 1888,
"preview": "/**\n * @barba/core/modules/Logger\n * <br><br>\n * ## Logger.\n *\n * - Display informations via the console\n *\n * @module c"
},
{
"path": "packages/core/src/modules/Prevent.ts",
"chars": 3810,
"preview": "/**\n * @barba/core/modules/prevent\n * <br><br>\n * ## Prevent checks.\n *\n * - Gathers all the tests that allow Barba to w"
},
{
"path": "packages/core/src/modules/Store.ts",
"chars": 8210,
"preview": "/**\n * @barba/core/modules/store\n * <br><br>\n * ## Transitions store.\n *\n * - Resolve transition\n * - Manage rules\n *\n *"
},
{
"path": "packages/core/src/modules/Transitions.ts",
"chars": 7960,
"preview": "/**\n * @barba/core/modules/transitions\n * <br><br>\n * ## Transitions manager.\n *\n * - Handle hooks and transition lifecy"
},
{
"path": "packages/core/src/modules/Views.ts",
"chars": 1557,
"preview": "/**\n * @barba/core/modules/views\n * <br><br>\n * ## Views manager.\n *\n * @module core/modules/views\n * @preferred\n */\n\n/*"
},
{
"path": "packages/core/src/polyfills/index.ts",
"chars": 704,
"preview": "// Element.prototype.matches polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill\nif (!"
},
{
"path": "packages/core/src/schemas/attribute.ts",
"chars": 411,
"preview": "/**\n * @barba/core/schemas\n * <br><br>\n * ## Schemas description.\n *\n * @module core/schemas\n * @preferred\n */\n\n/***/\n\n/"
},
{
"path": "packages/core/src/schemas/page.ts",
"chars": 298,
"preview": "/**\n * @module core/schemas\n */\n\n// Definitions\nimport { ISchemaPage } from '../defs';\n\n/**\n * See [[ISchemaPage]]\n */\ne"
},
{
"path": "packages/core/src/typings.ts",
"chars": 58,
"preview": "export * from './defs';\nexport { default } from './core';\n"
},
{
"path": "packages/core/src/utils/dom.ts",
"chars": 5507,
"preview": "/**\n * @barba/core/utils/dom\n * <br><br>\n * ## Dom utils\n *\n * - Access DOM contents\n * - DOM vs string conversions\n *\n "
},
{
"path": "packages/core/src/utils/helpers.ts",
"chars": 1842,
"preview": "/**\n * @barba/core/utils/helpers\n * <br><br>\n * ## Helpers\n *\n * - Update next page data\n *\n * @module core/utils/helper"
},
{
"path": "packages/core/src/utils/history.ts",
"chars": 6008,
"preview": "import { HistoryAction, LinkEvent, Trigger } from '../defs';\n// Schemas\nimport { schemaAttribute } from '../schemas/attr"
},
{
"path": "packages/core/src/utils/index.ts",
"chars": 200,
"preview": "import * as helpers from './helpers';\nimport * as url from './url';\n\nexport * from './dom';\nexport * from './history';\ne"
},
{
"path": "packages/core/src/utils/request.ts",
"chars": 2419,
"preview": "/**\n * @barba/core/utils/request\n * <br><br>\n * ## Fetch pages for transitions.\n *\n * - Includes timeout\n * - Uses Fetch"
},
{
"path": "packages/core/src/utils/run-async.ts",
"chars": 853,
"preview": "import isPromise from 'is-promise';\n\n// https://github.com/SBoudrias/run-async\n/* istanbul ignore next */\nexport functio"
},
{
"path": "packages/core/src/utils/url.ts",
"chars": 2360,
"preview": "/**\n * @barba/core/utils/url\n * <br><br>\n * ## URL utils.\n *\n * - Collect and structure informations from URLs\n *\n * @mo"
},
{
"path": "packages/css/.npmignore",
"chars": 125,
"preview": "### Custom ###\n/__e2e__\n/__mocks__\n/__tests__\n/__web__\n/jest.config.js\n/mangle.json\n/*.md\n/.rts2*\n!/README.md\n!/CHANGELO"
},
{
"path": "packages/css/AUTHORS",
"chars": 190,
"preview": "Luigi De Rosa <lurukee@gmail.com> (https://luruke.com/)\nThierry Michel <thmichel@gmail.com> (https://www.epic.net/)\nXavi"
},
{
"path": "packages/css/CHANGELOG.md",
"chars": 4732,
"preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
},
{
"path": "packages/css/LICENSE",
"chars": 1103,
"preview": "MIT License\n\nCopyright (c) 2024 Luigi De Rosa, Thierry Michel, Xavier Foucrier\n\nPermission is hereby granted, free of ch"
},
{
"path": "packages/css/README.md",
"chars": 464,
"preview": "# @barba/css\n\n[](https://www.npmjs.com/package/"
},
{
"path": "packages/css/__e2e__/default.spec.js",
"chars": 457,
"preview": "describe('Transition', () => {\n it('works', () => {\n cy.prepare('/index.html', 'home', 'home');\n // Click link\n "
},
{
"path": "packages/css/__e2e__/named.spec.js",
"chars": 465,
"preview": "describe('Named transition', () => {\n it('works', () => {\n cy.prepare('/named.html', 'named', 'named');\n // Click"
},
{
"path": "packages/css/__e2e__/once.spec.js",
"chars": 397,
"preview": "describe('Once transition', () => {\n it('works', () => {\n cy.prepare('/once.html', 'once', 'once');\n // Click lin"
},
{
"path": "packages/css/__tests__/css.classes.test.ts",
"chars": 341,
"preview": "import css from '../src';\n\n// Dom\nconst container = document.createElement('div');\nconst step = 'test';\n\nit('add/remove "
},
{
"path": "packages/css/__tests__/css.hooks.test.ts",
"chars": 2316,
"preview": "/* tslint:disable:no-string-literal */\nimport barba from '@barba/core/src';\n// Definitions\nimport { ISchemaPage, ITransi"
},
{
"path": "packages/css/__tests__/css.init.test.ts",
"chars": 1276,
"preview": "/* tslint:disable:no-string-literal */\nimport barba from '@barba/core/src';\nimport { version } from '../package.json';\ni"
},
{
"path": "packages/css/__tests__/css.prefix.test.ts",
"chars": 1429,
"preview": "/* tslint:disable:no-empty */\nimport barba from '@barba/core/src';\nimport css from '../src';\nimport { Css } from '../src"
},
{
"path": "packages/css/__tests__/css.states.test.ts",
"chars": 1682,
"preview": "/* tslint:disable:no-string-literal */\nimport barba from '@barba/core/src';\nimport css from '../src';\n\n// Dom\nconst cont"
},
{
"path": "packages/css/__web__/index.html",
"chars": 803,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "packages/css/__web__/named.html",
"chars": 802,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "packages/css/__web__/once.html",
"chars": 736,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width,"
},
{
"path": "packages/css/__web__/page.html",
"chars": 571,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "packages/css/__web__/scripts/default.js",
"chars": 117,
"preview": "console.info('🚀 Barba e2e');\n\nconst { barba, barbaCss: css } = window;\n\nbarba.use(css);\nbarba.init({ debug: true });\n"
},
{
"path": "packages/css/__web__/scripts/named.js",
"chars": 141,
"preview": "console.info('🚀 Barba e2e');\n\nconst { barba, barbaCss: css } = window;\n\nbarba.use(css);\nbarba.init({\n transitions: [{ n"
},
{
"path": "packages/css/__web__/styles/default.css",
"chars": 213,
"preview": "[data-barba='container'] {\n opacity: 1;\n}\n\n.barba-enter-active,\n.barba-leave-active {\n transition: opacity 2s;\n}\n\n.bar"
},
{
"path": "packages/css/__web__/styles/named.css",
"chars": 213,
"preview": "[data-barba='container'] {\n opacity: 1;\n}\n\n.named-enter-active,\n.named-leave-active {\n transition: opacity 2s;\n}\n\n.nam"
},
{
"path": "packages/css/__web__/styles/once.css",
"chars": 158,
"preview": "[data-barba='container'] {\n opacity: 1;\n}\n\n.barba-once {\n opacity: 0;\n}\n\n.barba-once-active {\n transition: opacity 5s"
},
{
"path": "packages/css/jest.config.js",
"chars": 88,
"preview": "const jestBase = require('../../jest.config.js');\n\nmodule.exports = {\n ...jestBase,\n};\n"
},
{
"path": "packages/css/package.json",
"chars": 1319,
"preview": "{\n \"name\": \"@barba/css\",\n \"version\": \"2.1.16\",\n \"description\": \"Style helper that manage you CSS classes during trans"
},
{
"path": "packages/css/src/css.ts",
"chars": 6340,
"preview": "/**\n * @barba/css\n * <br><br>\n * ## Barba CSS.\n *\n * - Add CSS classes\n * - Manage CSS transitions\n *\n * @module css\n * "
},
{
"path": "packages/css/src/defs/index.ts",
"chars": 164,
"preview": "/**\n * @module typings/css\n */\n\ntype CssKinds = 'once' | 'leave' | 'enter';\nexport interface ICssCallbacks {\n [key: str"
},
{
"path": "packages/css/src/index.ts",
"chars": 65,
"preview": "import * as t from './typings';\nexport { default } from './css';\n"
},
{
"path": "packages/css/src/typings.ts",
"chars": 57,
"preview": "export * from './defs';\nexport { default } from './css';\n"
},
{
"path": "packages/prefetch/.npmignore",
"chars": 125,
"preview": "### Custom ###\n/__e2e__\n/__mocks__\n/__tests__\n/__web__\n/jest.config.js\n/mangle.json\n/*.md\n/.rts2*\n!/README.md\n!/CHANGELO"
},
{
"path": "packages/prefetch/AUTHORS",
"chars": 190,
"preview": "Luigi De Rosa <lurukee@gmail.com> (https://luruke.com/)\nThierry Michel <thmichel@gmail.com> (https://www.epic.net/)\nXavi"
},
{
"path": "packages/prefetch/CHANGELOG.md",
"chars": 4215,
"preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
},
{
"path": "packages/prefetch/LICENSE",
"chars": 1103,
"preview": "MIT License\n\nCopyright (c) 2024 Luigi De Rosa, Thierry Michel, Xavier Foucrier\n\nPermission is hereby granted, free of ch"
},
{
"path": "packages/prefetch/README.md",
"chars": 494,
"preview": "# @barba/prefetch\n\n[](https://www.npmjs.co"
},
{
"path": "packages/prefetch/__e2e__/prefetch.spec.js",
"chars": 119,
"preview": "describe('page', () => {\n it('Page is visible', () => {\n cy.visit('/');\n expect(true).to.equal(true);\n });\n});\n"
},
{
"path": "packages/prefetch/__tests__/prefetch.init.test.ts",
"chars": 1975,
"preview": "/* tslint:disable:no-empty */\nimport barba from '@barba/core/src';\nimport { version } from '../package.json';\nimport pre"
},
{
"path": "packages/prefetch/__web__/index.html",
"chars": 291,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-wid"
},
{
"path": "packages/prefetch/jest.config.js",
"chars": 88,
"preview": "const jestBase = require('../../jest.config.js');\n\nmodule.exports = {\n ...jestBase,\n};\n"
},
{
"path": "packages/prefetch/package.json",
"chars": 1473,
"preview": "{\n \"name\": \"@barba/prefetch\",\n \"version\": \"2.2.0\",\n \"description\": \"Automatically fetch and cache your pages based on"
},
{
"path": "packages/prefetch/src/defs/index.ts",
"chars": 150,
"preview": "/**\n * @module typings/prefetch\n */\n\nexport interface IPrefetchOptions {\n root?: HTMLElement | HTMLDocument;\n timeout?"
},
{
"path": "packages/prefetch/src/index.ts",
"chars": 70,
"preview": "import * as t from './typings';\nexport { default } from './prefetch';\n"
},
{
"path": "packages/prefetch/src/polyfills/index.ts",
"chars": 192,
"preview": "// Browser support + polyfills\n// if (window.NodeList && !NodeList.prototype.forEach) {\n// NodeList.prototype.forEach "
},
{
"path": "packages/prefetch/src/polyfills/requestIdleCallback.ts",
"chars": 1141,
"preview": "/**\n * @module prefetch/polyfills\n */\n/**\n * Copyright 2018 Google Inc.\n *\n * Licensed under the Apache License, Version"
},
{
"path": "packages/prefetch/src/prefetch.ts",
"chars": 3680,
"preview": "/**\n * @barba/prefetch\n * <br><br>\n * ## Barba prefetch.\n *\n * @module prefetch\n * @preferred\n */\n\nimport { IPrefetchOpt"
},
{
"path": "packages/prefetch/src/typings.ts",
"chars": 62,
"preview": "export * from './defs';\nexport { default } from './prefetch';\n"
},
{
"path": "packages/router/.npmignore",
"chars": 125,
"preview": "### Custom ###\n/__e2e__\n/__mocks__\n/__tests__\n/__web__\n/jest.config.js\n/mangle.json\n/*.md\n/.rts2*\n!/README.md\n!/CHANGELO"
},
{
"path": "packages/router/AUTHORS",
"chars": 190,
"preview": "Luigi De Rosa <lurukee@gmail.com> (https://luruke.com/)\nThierry Michel <thmichel@gmail.com> (https://www.epic.net/)\nXavi"
},
{
"path": "packages/router/CHANGELOG.md",
"chars": 3073,
"preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
},
{
"path": "packages/router/LICENSE",
"chars": 1103,
"preview": "MIT License\n\nCopyright (c) 2024 Luigi De Rosa, Thierry Michel, Xavier Foucrier\n\nPermission is hereby granted, free of ch"
},
{
"path": "packages/router/README.md",
"chars": 482,
"preview": "# @barba/router\n\n[](https://www.npmjs.com/pa"
},
{
"path": "packages/router/__e2e__/default.spec.js",
"chars": 1248,
"preview": "/* eslint-disable cypress/no-unnecessary-waiting */\nconst logs = [\n 'leave-from',\n 'enter-from',\n 'leave-default',\n "
},
{
"path": "packages/router/__tests__/router.test.ts",
"chars": 2753,
"preview": "import barba from '@barba/core/src';\n// Definitions\nimport { ITransitionData } from '@barba/core/src/defs';\nimport { ver"
},
{
"path": "packages/router/__web__/default.html",
"chars": 524,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width,"
},
{
"path": "packages/router/__web__/index.html",
"chars": 789,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width,"
},
{
"path": "packages/router/__web__/page.html",
"chars": 580,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width,"
},
{
"path": "packages/router/__web__/scripts/default.js",
"chars": 1694,
"preview": "console.info('🚀 Barba e2e');\n\nconst { barba, barbaRouter: router } = window;\n\nconst list = document.querySelector('[data"
}
]
// ... and 10 more files (download for full content)
About this extraction
This page contains the full source code of the barbajs/barba GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 210 files (353.7 KB), approximately 107.8k tokens, and a symbol index with 303 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.