Skip to content

Commit

Permalink
initial revision
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp committed Sep 24, 2024
0 parents commit 3708e30
Show file tree
Hide file tree
Showing 26 changed files with 1,901 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: martrapp
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "\U0001F41B Bug Report"
description: Report an issue or possible bug
labels: []
assignees: []
body:
- type: markdown
attributes:
value: |
## Quick Checklist
Thank you for taking the time to file a bug report! Please fill out this form as completely as possible.
✅ I am using the **latest version of the Bag of Tricks**
✅ I have searched all issues here to see if this has already been reported
- type: textarea
id: bug-description
attributes:
label: Describe the Bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: bug-expectation
attributes:
label: What's the expected result?
description: Describe what you expect to happen.
validations:
required: true
- type: input
id: bug-reproduction
attributes:
label: Link to Minimal Reproducible Example
description: '**A minimal reproduction is required** so that others can help debug your issue.'
placeholder: 'https://github.com/you/your-minimal-repo'
validations:
required: true
- type: checkboxes
id: will-pr
attributes:
label: Participation
options:
- label: I am willing to submit a pull request for this issue.
required: false
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: GitHub Discussions
url: https://github.com/vtbag/turn-signal/discussions
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 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "✨ Feature Request"
description: Want to see new functionalities? Use this link.
labels: [enhancement]
assignees: []
body:
- type: textarea
id: feature-description
attributes:
label: Describe the Request
description: A clear and concise description of what the new feature should be.
validations:
required: true
- type: checkboxes
id: will-pr
attributes:
label: Participation
options:
- label: I am willing to contribute a PR to make this happen.
required: false
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- 🙌 Thanks for contributing to the vtbag packages! -->
### Description

- Summarize your changes in one or two sentences.
- Don't forget `npm changeset`

### Tests

- How was this change tested?


### Docs & Examples

- Does your change here require changes to the vtbag-website?
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Package to npmjs
on:
workflow_dispatch:
inputs:
options:
description: 'Publish options'
required: true
default: '--dry-run'
type: choice
options:
- '--dry-run'
- '--provenance --access public'
- '--provenance --access public --tag preview'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
scope: '@vtbag'
- run: npm install -g npm
- run: npm ci
- run: npm run build
- run: npm publish ${OPTIONS}
env:
OPTIONS: ${{ inputs.options }}
NODE_AUTH_TOKEN: ${{ secrets.VTBAG_NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
if: github.repository == 'vtbag/turn-signal'
permissions:
contents: write
pull-requests: write
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- name: Create Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/run-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

name: Build

on:
workflow_dispatch:
push:
branches: [ main ]

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: npm
cache-dependency-path: ./package-lock.json

- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
32 changes: 32 additions & 0 deletions .github/workflows/run-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check build

on:
workflow_dispatch:
pull_request:
branches: [ main ]

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- '18.x'
- '20.x'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci
- name: Build
run: npm run build



3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
lib
.astro
Empty file added .npmignore
Empty file.
9 changes: 9 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("@types/prettier").Options} */
module.exports = {
printWidth: 100,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: true,
};
Empty file added CHANGELOG.md
Empty file.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[⭐️Please star to support this work⭐️](https://github.com/vtbag/turn-signal)

# 🔙 The Turn Signal

Turn-Signal: Directional view transitions for intuitive navigation.

![Build Status](https://github.com/vtbag/turn-signal/actions/workflows/run-build.yml/badge.svg)
[![npm version](https://img.shields.io/npm/v/@vtbag/turn-signal/latest)](https://www.npmjs.com/package/@vtbag/turn-signal)
![minzip](https://badgen.net/bundlephobia/minzip/@vtbag/turn-signal)
[![NPM Downloads](https://img.shields.io/npm/dw/@vtbag/turn-signal)](https://www.npmjs.com/package/@vtbag/turn-signal)

The @vtbag website can be found at https://vtbag.pages.dev/

## !!! News !!!

First official release of this code!

For details see the [CHANGELOG](https://github.com/vtbag/turn-signal/blob/main/CHANGELOG.md)


## What is it?

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.

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.

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.

If your site has the concept of a _previous_ and _next_ page, the Turn-Signal can automatically generate directional transitions for you.

[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/).
9 changes: 9 additions & 0 deletions bin/bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

if [ "$1" = "dev" ]; then
OPTS="--sourcemap --watch"
else
OPTS="--minify"
(cd lib && rm *.js.map) >> /dev/null 2>&1
fi
npx esbuild src/index.ts src/forced-traversal.ts --bundle $OPTS --target=ESnext --outdir=lib
3 changes: 3 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

echo "see @vtbag/website"
11 changes: 11 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


export default [
{files: ["src/**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Loading

0 comments on commit 3708e30

Please sign in to comment.