Skip to content

Commit a5f4e31

Browse files
committedSep 18, 2024·
Project import generated by Copybara.
GitOrigin-RevId: 6ca58737cfc525c7e02ab1e6c5e339c2104e5177
0 parents  commit a5f4e31

23 files changed

+1131
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Mirror react-router-busy to Own Repo
2+
3+
on:
4+
push:
5+
schedule:
6+
# Only sync to destination once a week
7+
- cron: '0 0 * * 0'
8+
pull_request_target:
9+
jobs:
10+
move-code:
11+
# Just don't run push in monorepo since we use cron there
12+
# Still run on push in destination repo since it might be needed
13+
# Note PR opened in dest repo pushes commit to source repo and now it's not run, doesn't seem to matter but if it does check actor
14+
# And when PR merged in source, it still closes PR in destination but doesn't update destination repo
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Run Copybara
23+
uses: bitofbreeze/copybara-action@main
24+
with:
25+
access_token: ${{ secrets.COPY_GITHUB_REPO_TOKEN }}
26+
ssh_key: ${{ secrets.COPY_SSH_KEY_RR_BUSY }}
27+
sot_repo: bitofbreeze/mono
28+
destination_repo: bitofbreeze/react-router-busy
29+
push_files: "glob(['**'], exclude = ['apps/**', 'packages/**', '.github/workflows/*.yml']) + glob(['packages/react-router-busy/**', '.github/workflows/packages.react-router-busy.*.yml'])"
30+
push_mode: "SQUASH"
31+
# Make sure to always remove init-history after first copybara push, else PRs created in destination will fail the workflow since --init-history is not compatible with CHANGE_REQUEST
32+
copybara_options: --init-history

‎.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.DS_Store
2+
3+
node_modules
4+
5+
# Generated by `bun install -y` just for inspection
6+
yarn.lock
7+
8+
.env
9+
10+
.wrangler
11+
12+
*.db
13+
14+
# dev secrets
15+
.dev.vars
16+
17+
.partykit
18+
19+
build/
20+
21+
# Don't see this anywhere
22+
# .cache

‎.vscode/extensions.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"eamodio.gitlens",
8+
"bradlc.vscode-tailwindcss",
9+
"biomejs.biome",
10+
"tamasfe.even-better-toml",
11+
// Autocomplete Tailwind CSS variables
12+
"vunguyentuan.vscode-css-variables",
13+
// Markdown formatter and shortcuts
14+
"yzhang.markdown-all-in-one",
15+
"arktypeio.arkdark",
16+
"Gruntfuggly.todo-tree",
17+
"formulahendry.auto-rename-tag",
18+
"GitHub.vscode-github-actions"
19+
],
20+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
21+
"unwantedRecommendations": []
22+
}

‎.vscode/settings.json

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.codeActionsOnSave": {
4+
"quickfix.biome": "explicit",
5+
"source.organizeImports.biome": "explicit"
6+
},
7+
"editor.tabSize": 2,
8+
"editor.defaultFormatter": "biomejs.biome",
9+
"[css]": {
10+
"editor.defaultFormatter": "vscode.css-language-features"
11+
},
12+
"tailwindCSS.classAttributes": ["class", "className", "tw"],
13+
"files.associations": {
14+
"*.css": "tailwindcss"
15+
},
16+
"cssVariables.languages": [
17+
"astro",
18+
"svelte",
19+
"vue",
20+
"vue-html",
21+
"vue-postcss",
22+
"scss",
23+
"postcss",
24+
"less",
25+
"css",
26+
"html",
27+
"javascript",
28+
"javascriptreact",
29+
// "typescript",
30+
// Adds it for normal objects
31+
// "typescriptreact",
32+
"source.css.styled",
33+
"tailwindcss"
34+
],
35+
"cssVariables.lookupFiles": [
36+
"**/*.css",
37+
"**/*.scss",
38+
"**/*.sass",
39+
"**/*.less",
40+
// Doesn't work with index.css
41+
"node_modules/tailwindcss/theme.css"
42+
],
43+
"[markdown]": {
44+
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
45+
},
46+
"cSpell.words": [
47+
"arethetypeswrong",
48+
"arktype",
49+
"attw",
50+
"biomejs",
51+
"bunx",
52+
"clipboardy",
53+
"deepmerge",
54+
"fastify",
55+
"Gitsell",
56+
"Hola",
57+
"isbot",
58+
"Konnichi",
59+
"libsql",
60+
"Markdoc",
61+
"miniflare",
62+
"Namecheap",
63+
"partykit",
64+
"partysocket",
65+
"Renderable",
66+
"revalidator",
67+
"sindresorhus",
68+
"sitekey",
69+
"spritesheet",
70+
"tailwindcss",
71+
"toastify",
72+
"totp",
73+
"Turso",
74+
"unlisting",
75+
"unsuspended",
76+
"unsuspending",
77+
"Visx",
78+
"workerd"
79+
]
80+
}

‎README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# monorepo
2+
3+
Bun monorepos are a bit undeveloped and undocumented. Some common commands you'll need are:
4+
* bun i typescript --cwd apps/app2
5+
* bun --filter git-sell dev
6+
* bun --cwd apps/git-sell ngrok http 5173 --domain=pleased-manually-lab.ngrok-free.app
7+

‎biome.jsonc

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"ignore": [],
9+
"rules": {
10+
"recommended": true,
11+
"a11y": {
12+
"useButtonType": "off",
13+
"noInteractiveElementToNoninteractiveRole": "warn"
14+
},
15+
"style": {
16+
"noNonNullAssertion": "warn",
17+
"noParameterAssign": "warn"
18+
},
19+
"suspicious": {
20+
"noExplicitAny": "warn",
21+
"noArrayIndexKey": "warn",
22+
"noConfusingLabels": "warn"
23+
},
24+
"nursery": {
25+
// https://github.com/biomejs/biome/issues/1274
26+
// "useSortedClasses":"error"
27+
}
28+
}
29+
},
30+
"formatter": {
31+
"ignore": [
32+
// Until we fix vite-plugin-icons-spritesheet
33+
"./apps/git-sell/public/icons/*"
34+
// Until biome handles nested gitignore files
35+
// Actually not tracked in git so doesn't matter
36+
// "./packages/react-router-busy/dist/*"
37+
]
38+
},
39+
"vcs": {
40+
// Biome can't use nested .gitignore files yet https://github.com/biomejs/biome/issues/2312
41+
"enabled": true,
42+
"clientKind": "git",
43+
"useIgnoreFile": true,
44+
"defaultBranch": "main"
45+
}
46+
}

‎bun.lockb

454 KB
Binary file not shown.

‎bunfig.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
telemetry = false
2+
3+
[install.lockfile]
4+
# Needed for patch-package https://github.com/oven-sh/bun/issues/2336#issuecomment-2028402422
5+
print = "yarn" # Whether to generate a non-Bun lockfile alongside bun.lockb
6+
7+
[install]
8+
# Pin dependencies by default
9+
exact = true
10+
11+
[test]
12+
preload = "./happydom.ts"

‎happydom.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { GlobalRegistrator } from "@happy-dom/global-registrator";
2+
3+
GlobalRegistrator.register();

‎package.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "mono",
3+
"private": true,
4+
"devDependencies": {
5+
"@biomejs/biome": "1.9.0",
6+
"@happy-dom/global-registrator": "15.7.3"
7+
},
8+
"engines": {
9+
"node": ">=20.6.0"
10+
},
11+
"scripts": {
12+
"//lint": "No monorepo support yet so just use from root https://github.com/biomejs/biome/issues/2228",
13+
"lint": "bunx @biomejs/biome check --vcs-use-ignore-file true --write .",
14+
"postinstall": "patch-package"
15+
},
16+
"trustedDependencies": ["@biomejs/biome", "esbuild", "ngrok", "workerd"],
17+
"workspaces": ["apps/*", "packages/*"],
18+
"packageManager": "bun@1.1.27"
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Integrate
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
integrate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Set up Bun
18+
uses: oven-sh/setup-bun@v2.0.1
19+
with:
20+
bun-version: latest
21+
- name: Install dependencies (`npm ci`)
22+
run: bun install --frozen-lockfile
23+
# Build checks types so no need for separate typecheck step
24+
- name: Build
25+
run: bun run build
26+
- name: Check exports
27+
run: bun run check-exports
28+
- name: Test
29+
run: bun test

‎packages/react-router-busy/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

‎packages/react-router-busy/LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 bitofbreeze
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎packages/react-router-busy/README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# react-router-busy
2+
3+
A simple and performant package for managed, accessible form and button loading states.
4+
5+
## BusyForm
6+
7+
Render `BusyForm` instead of `Form` or `fetcher.Form`:
8+
* All the form's inputs will become `readonly` during submission to prevent someone from changing input data during submission and causing themselves confusion. The `cursor` will be `wait` if hovering over an input.
9+
* The form's submit button will become `aria-busy="true"` during submission to prevent double-clicking and causing extraneous requests. The `cursor` will be `wait` if hovering over the button, and `pointer-events` will be `none` to actually prevent clicking. A keyboard user can currently still repress the button though because I haven't found a way to prevent it.
10+
11+
I chose these attributes instead of `disabled` because it causes the field to not be sent in the form data and it's not accessibility friendly
12+
13+
### With fetcher
14+
15+
```tsx
16+
const fetcher = useFetcher({ key: "key" });
17+
18+
return (
19+
<BusyForm
20+
action="/action"
21+
method="POST"
22+
navigate={false}
23+
fetcherKey="key"
24+
>
25+
{...inputs}
26+
<button>Submit</button>
27+
</BusyForm>
28+
)
29+
```
30+
31+
### With navigation
32+
33+
```tsx
34+
return (
35+
<BusyForm
36+
action="/action"
37+
method="POST"
38+
>
39+
{...inputs}
40+
<button>Submit</button>
41+
</BusyForm>
42+
)
43+
```
44+
45+
## BusyLink
46+
47+
This library assumes all your buttons are in forms. But links are another story, so `BusyLink` is a replacement for `Link` to add this functionality.
48+
49+
### Link
50+
51+
```tsx
52+
return (
53+
<BusyLink
54+
to=""
55+
>
56+
Link
57+
</BusyLink>
58+
)
59+
```
60+
61+
### NavLink
62+
63+
TODO Better not to have all that extra code for the `as` prop

0 commit comments

Comments
 (0)