Skip to content

Commit 3708e30

Browse files
committed
initial revision
0 parents  commit 3708e30

26 files changed

+1901
-0
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: martrapp

.github/ISSUE_TEMPLATE/bug-report.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "\U0001F41B Bug Report"
2+
description: Report an issue or possible bug
3+
labels: []
4+
assignees: []
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
## Quick Checklist
10+
Thank you for taking the time to file a bug report! Please fill out this form as completely as possible.
11+
12+
✅ I am using the **latest version of the Bag of Tricks**
13+
✅ I have searched all issues here to see if this has already been reported
14+
- type: textarea
15+
id: bug-description
16+
attributes:
17+
label: Describe the Bug
18+
description: A clear and concise description of what the bug is.
19+
validations:
20+
required: true
21+
- type: textarea
22+
id: bug-expectation
23+
attributes:
24+
label: What's the expected result?
25+
description: Describe what you expect to happen.
26+
validations:
27+
required: true
28+
- type: input
29+
id: bug-reproduction
30+
attributes:
31+
label: Link to Minimal Reproducible Example
32+
description: '**A minimal reproduction is required** so that others can help debug your issue.'
33+
placeholder: 'https://github.com/you/your-minimal-repo'
34+
validations:
35+
required: true
36+
- type: checkboxes
37+
id: will-pr
38+
attributes:
39+
label: Participation
40+
options:
41+
- label: I am willing to submit a pull request for this issue.
42+
required: false

.github/ISSUE_TEMPLATE/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: GitHub Discussions
4+
url: https://github.com/vtbag/turn-signal/discussions
5+
about: Does the issue involve a lot of explanation, or are you not sure how it can be split into actionable tasks? Consider starting a discussion first.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "✨ Feature Request"
2+
description: Want to see new functionalities? Use this link.
3+
labels: [enhancement]
4+
assignees: []
5+
body:
6+
- type: textarea
7+
id: feature-description
8+
attributes:
9+
label: Describe the Request
10+
description: A clear and concise description of what the new feature should be.
11+
validations:
12+
required: true
13+
- type: checkboxes
14+
id: will-pr
15+
attributes:
16+
label: Participation
17+
options:
18+
- label: I am willing to contribute a PR to make this happen.
19+
required: false

.github/PULL_REQUEST_TEMPLATE.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!-- 🙌 Thanks for contributing to the vtbag packages! -->
2+
### Description
3+
4+
- Summarize your changes in one or two sentences.
5+
- Don't forget `npm changeset`
6+
7+
### Tests
8+
9+
- How was this change tested?
10+
11+
12+
### Docs & Examples
13+
14+
- Does your change here require changes to the vtbag-website?

.github/dependabot.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
9+
# Maintain dependencies for GitHub Actions
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "monthly"
14+
15+
# Maintain dependencies for npm
16+
- package-ecosystem: "npm"
17+
directory: "/"
18+
schedule:
19+
interval: "monthly"

.github/workflows/publish.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Package to npmjs
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
options:
6+
description: 'Publish options'
7+
required: true
8+
default: '--dry-run'
9+
type: choice
10+
options:
11+
- '--dry-run'
12+
- '--provenance --access public'
13+
- '--provenance --access public --tag preview'
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
id-token: write
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: '18.x'
26+
registry-url: 'https://registry.npmjs.org'
27+
scope: '@vtbag'
28+
- run: npm install -g npm
29+
- run: npm ci
30+
- run: npm run build
31+
- run: npm publish ${OPTIONS}
32+
env:
33+
OPTIONS: ${{ inputs.options }}
34+
NODE_AUTH_TOKEN: ${{ secrets.VTBAG_NPM_TOKEN }}

.github/workflows/release.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
concurrency: ${{ github.workflow }}-${{ github.ref }}
7+
8+
jobs:
9+
release:
10+
if: github.repository == 'vtbag/turn-signal'
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
name: Release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 18
21+
- run: npm ci
22+
- name: Create Release Pull Request
23+
uses: changesets/action@v1
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/run-build.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
name: Build
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: "18"
21+
cache: npm
22+
cache-dependency-path: ./package-lock.json
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
- name: Build
27+
run: npm run build

.github/workflows/run-checks.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version:
15+
- '18.x'
16+
- '20.x'
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
- name: Build
29+
run: npm run build
30+
31+
32+

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
lib
3+
.astro

.npmignore

Whitespace-only changes.

.prettierrc.cjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import("@types/prettier").Options} */
2+
module.exports = {
3+
printWidth: 100,
4+
semi: true,
5+
singleQuote: true,
6+
tabWidth: 2,
7+
trailingComma: 'es5',
8+
useTabs: true,
9+
};

CHANGELOG.md

Whitespace-only changes.

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[⭐️Please star to support this work⭐️](https://github.com/vtbag/turn-signal)
2+
3+
# 🔙 The Turn Signal
4+
5+
Turn-Signal: Directional view transitions for intuitive navigation.
6+
7+
![Build Status](https://github.com/vtbag/turn-signal/actions/workflows/run-build.yml/badge.svg)
8+
[![npm version](https://img.shields.io/npm/v/@vtbag/turn-signal/latest)](https://www.npmjs.com/package/@vtbag/turn-signal)
9+
![minzip](https://badgen.net/bundlephobia/minzip/@vtbag/turn-signal)
10+
[![NPM Downloads](https://img.shields.io/npm/dw/@vtbag/turn-signal)](https://www.npmjs.com/package/@vtbag/turn-signal)
11+
12+
The @vtbag website can be found at https://vtbag.pages.dev/
13+
14+
## !!! News !!!
15+
16+
First official release of this code!
17+
18+
For details see the [CHANGELOG](https://github.com/vtbag/turn-signal/blob/main/CHANGELOG.md)
19+
20+
21+
## What is it?
22+
23+
Turn-Signal is a lightweight script that enhances cross-document view transitions by detecting the direction of browser navigation. It enables developers to create smooth, responsive transitions that adjust based on forward or backward navigation, delivering a more intuitive user experience.
24+
25+
When your pages slide to the left on forward navigation, let them slide to the right when the users goes back in the browser's history.
26+
27+
The script automatically detects the traversal direction and sets `backward`, `neither` or `forward` view transition types accordingly. You can also instruct the script to set data attributes on the `<html>` element.
28+
29+
If your site has the concept of a _previous_ and _next_ page, the Turn-Signal can automatically generate directional transitions for you.
30+
31+
[See the Turn Signal in action](https://vtbag.pages.dev/signal/1/) and [see how it can be customized](https://vtbag.pages.dev/tools/turn-signal/).

bin/bundle

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/sh
2+
3+
if [ "$1" = "dev" ]; then
4+
OPTS="--sourcemap --watch"
5+
else
6+
OPTS="--minify"
7+
(cd lib && rm *.js.map) >> /dev/null 2>&1
8+
fi
9+
npx esbuild src/index.ts src/forced-traversal.ts --bundle $OPTS --target=ESnext --outdir=lib

bin/test

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /bin/sh
2+
3+
echo "see @vtbag/website"

eslint.config.mjs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import globals from "globals";
2+
import pluginJs from "@eslint/js";
3+
import tseslint from "typescript-eslint";
4+
5+
6+
export default [
7+
{files: ["src/**/*.{js,mjs,cjs,ts}"]},
8+
{languageOptions: { globals: globals.browser }},
9+
pluginJs.configs.recommended,
10+
...tseslint.configs.recommended,
11+
];

0 commit comments

Comments
 (0)