Compare commits
251 Commits
feat/new-c
...
@discordjs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cce8194b9f | ||
|
|
f4b4918200 | ||
|
|
d500d97666 | ||
|
|
6727634758 | ||
|
|
a3c6bce3a8 | ||
|
|
214c6cbdd6 | ||
|
|
492039c4f6 | ||
|
|
b0542f30e2 | ||
|
|
84197a0ee0 | ||
|
|
33bfdedf35 | ||
|
|
caa7833ffb | ||
|
|
b14d8d970b | ||
|
|
d4d326b70d | ||
|
|
d4b0f4de5f | ||
|
|
f040c6f6a5 | ||
|
|
6f05c96ab4 | ||
|
|
62f2ca5fbb | ||
|
|
610b4bbacb | ||
|
|
8469fb3bad | ||
|
|
d25ef434ae | ||
|
|
2deea25e97 | ||
|
|
5c5b545c38 | ||
|
|
eeeef2ac50 | ||
|
|
ccbe0716a4 | ||
|
|
a9fcfc0586 | ||
|
|
36d6f0e55b | ||
|
|
1e060e5bde | ||
|
|
c5b71a756b | ||
|
|
6c781ede30 | ||
|
|
be38128ea1 | ||
|
|
737a97d068 | ||
|
|
b26af3cf38 | ||
|
|
169b05f319 | ||
|
|
bf0430f998 | ||
|
|
2da2fa01b2 | ||
|
|
1c5701651a | ||
|
|
b6a8264d6b | ||
|
|
a7196dc969 | ||
|
|
a03661844f | ||
|
|
fb2b7281e0 | ||
|
|
c303bf3329 | ||
|
|
c2c8cce1d7 | ||
|
|
abb84ce88f | ||
|
|
d317ca1053 | ||
|
|
072fbb228a | ||
|
|
548c25488a | ||
|
|
16a44f83e5 | ||
|
|
0dda270ea5 | ||
|
|
ee988e3e75 | ||
|
|
104ad754f3 | ||
|
|
0ff239a602 | ||
|
|
89fd19e08a | ||
|
|
6a6c7d0333 | ||
|
|
083f6abb38 | ||
|
|
5cc13b735c | ||
|
|
1e4d1dc04f | ||
|
|
177d81f596 | ||
|
|
bf4cfeb4bf | ||
|
|
11b236ff65 | ||
|
|
1d5b9837de | ||
|
|
8065b80cea | ||
|
|
3b26680672 | ||
|
|
c4dbd7ee9f | ||
|
|
72771b79aa | ||
|
|
63dbe48055 | ||
|
|
67c8953a10 | ||
|
|
30e35d909e | ||
|
|
6a5707c786 | ||
|
|
9b821e5dfc | ||
|
|
a04172325a | ||
|
|
154c00ded9 | ||
|
|
3b927449ae | ||
|
|
fcce0d95bb | ||
|
|
93e0f4cd10 | ||
|
|
abaae4ff16 | ||
|
|
270d9f1047 | ||
|
|
9ae737708b | ||
|
|
e382d60421 | ||
|
|
68aa202cd6 | ||
|
|
d8ad181c19 | ||
|
|
0dff969e16 | ||
|
|
79d999e4c1 | ||
|
|
215f8dc5e0 | ||
|
|
b6089e585e | ||
|
|
fe025c0a9f | ||
|
|
4a8aeb6aee | ||
|
|
3dd57c2eaf | ||
|
|
740da4ce5e | ||
|
|
6fb0b1cef6 | ||
|
|
ac6ff15b7d | ||
|
|
a294b47db0 | ||
|
|
ecef7bdf22 | ||
|
|
40578393c3 | ||
|
|
86ecb37c9e | ||
|
|
311e826b12 | ||
|
|
dceac0089d | ||
|
|
a2f7d3ad54 | ||
|
|
b532df61ed | ||
|
|
d60e0bf30b | ||
|
|
baa08b8fbb | ||
|
|
f469f74aca | ||
|
|
90d3b28268 | ||
|
|
a271e9b51e | ||
|
|
8ac0e1e5d6 | ||
|
|
9d6fdf8979 | ||
|
|
cafe58b3bd | ||
|
|
7eca844f6d | ||
|
|
63f5261f4c | ||
|
|
5be774db64 | ||
|
|
b36b751bde | ||
|
|
500712d5ea | ||
|
|
040c66ae15 | ||
|
|
82378fc2e8 | ||
|
|
d4f742e99e | ||
|
|
51ceb203fa | ||
|
|
1404e32849 | ||
|
|
9fc3e5ea72 | ||
|
|
19e74b1533 | ||
|
|
de22a10038 | ||
|
|
8ab30cdefa | ||
|
|
c2a43b685e | ||
|
|
507b696792 | ||
|
|
15f7571243 | ||
|
|
3fa429c7df | ||
|
|
7713627fd1 | ||
|
|
6a5c0fb32d | ||
|
|
eb5acd1e30 | ||
|
|
127021d5ab | ||
|
|
0943bc2efb | ||
|
|
a1c83c17d6 | ||
|
|
c0eae344c2 | ||
|
|
f2f757ce52 | ||
|
|
65cfa3ffd3 | ||
|
|
ee2eb7349f | ||
|
|
2d19163d76 | ||
|
|
9bca4af5fd | ||
|
|
fe5e344adc | ||
|
|
c8f6066d6a | ||
|
|
7e21a9474e | ||
|
|
d0a535ea6a | ||
|
|
8124fc68be | ||
|
|
dbd5354056 | ||
|
|
2ebb5cbd53 | ||
|
|
096cd92b87 | ||
|
|
37ef57b880 | ||
|
|
e3c247e423 | ||
|
|
5f3fc170fb | ||
|
|
20fade2a87 | ||
|
|
e827644b5a | ||
|
|
62815928ab | ||
|
|
7fb6630c02 | ||
|
|
737b80b5f2 | ||
|
|
481ccd228b | ||
|
|
a3fff7b8be | ||
|
|
8cdbe23766 | ||
|
|
d920933dc5 | ||
|
|
2d817df3b5 | ||
|
|
1605a2c289 | ||
|
|
464ea2ab30 | ||
|
|
0d1d54a537 | ||
|
|
dd8bb397a8 | ||
|
|
61d3d6d4ae | ||
|
|
512b0c67b9 | ||
|
|
532c3842bc | ||
|
|
edace17a13 | ||
|
|
d3154cf8f1 | ||
|
|
45552faf02 | ||
|
|
ebfd52695e | ||
|
|
595bded8a5 | ||
|
|
c74c632cdb | ||
|
|
fc003050de | ||
|
|
8702978057 | ||
|
|
c2b18d6d8b | ||
|
|
519aa3abe8 | ||
|
|
89c076c89e | ||
|
|
f224a07381 | ||
|
|
8e1e1be0c2 | ||
|
|
193a5e9e20 | ||
|
|
73c6bc2c36 | ||
|
|
b7f1ebc334 | ||
|
|
92aea94411 | ||
|
|
41dee5177d | ||
|
|
bbde371324 | ||
|
|
66b971899a | ||
|
|
43235d43fe | ||
|
|
31df3d21cd | ||
|
|
2663d76709 | ||
|
|
44a1e85847 | ||
|
|
d2e1924fa6 | ||
|
|
68dd260dee | ||
|
|
5e66f85f55 | ||
|
|
46060419a9 | ||
|
|
7c1b73cc69 | ||
|
|
95db597fc8 | ||
|
|
0047a49b73 | ||
|
|
32dff01f29 | ||
|
|
efa50fc3fa | ||
|
|
aa61c20ffd | ||
|
|
d48136bee1 | ||
|
|
46bf8f0146 | ||
|
|
7280d4e82e | ||
|
|
bd2914cc98 | ||
|
|
77804cfd55 | ||
|
|
8fea3ed978 | ||
|
|
05c63cd9a1 | ||
|
|
8d69b24b5c | ||
|
|
9baee4b2ce | ||
|
|
c986a99104 | ||
|
|
2b9e4cf9d0 | ||
|
|
1af2f4ed0e | ||
|
|
3fbfe9f1ae | ||
|
|
b901ff7c4c | ||
|
|
5f8915f6d1 | ||
|
|
ff42d7af72 | ||
|
|
0fdbabea98 | ||
|
|
e9944b3d2d | ||
|
|
2b9833cd36 | ||
|
|
7b2a2e3a15 | ||
|
|
6087088579 | ||
|
|
622acbcbf0 | ||
|
|
b2754d4a0e | ||
|
|
53cbb0e36d | ||
|
|
7ce6f2fc8a | ||
|
|
76042f0538 | ||
|
|
dedaa5d657 | ||
|
|
ed00a10e1f | ||
|
|
ae1deac2bf | ||
|
|
a367e2c8c9 | ||
|
|
7678f1176a | ||
|
|
4cca33d9b0 | ||
|
|
388783d7dd | ||
|
|
bda31284bf | ||
|
|
76968b4bc1 | ||
|
|
34343c6afa | ||
|
|
56c9396b71 | ||
|
|
21c283f964 | ||
|
|
13471fa1b7 | ||
|
|
b1ded63e42 | ||
|
|
565fc0192a | ||
|
|
33533b7284 | ||
|
|
be38f57926 | ||
|
|
f79ba52c7a | ||
|
|
72e0c99454 | ||
|
|
3d06c9d872 | ||
|
|
831aafa733 | ||
|
|
5faf074c14 | ||
|
|
297e959f48 | ||
|
|
1fc87a9698 | ||
|
|
366f7174d0 | ||
|
|
97c3237a70 | ||
|
|
c12217829b |
2
.github/.kodiak.toml
vendored
@@ -2,7 +2,7 @@ version = 1
|
||||
|
||||
[merge]
|
||||
require_automerge_label = false
|
||||
blocking_labels = ['blocked', 'in review', 'semver:major']
|
||||
blocking_labels = ['blocked', 'in review']
|
||||
method = 'squash'
|
||||
|
||||
[merge.message]
|
||||
|
||||
9
.github/CODEOWNERS
vendored
@@ -3,16 +3,7 @@
|
||||
|
||||
* @iCrawl
|
||||
|
||||
package.json @discordjs/core
|
||||
pnpm-lock.yaml @discordjs/core
|
||||
|
||||
/apps/guide/ @discordjs/website @discordjs/guide
|
||||
/apps/guide/src/content/ @discordjs/guide
|
||||
/apps/website/ @discordjs/website
|
||||
|
||||
/packages/actions/ @discordjs/actions
|
||||
/packages/api-extractor/ @discordjs/api-extractor-utils
|
||||
/packages/api-extractor-model/ @discordjs/api-extractor-utils
|
||||
/packages/api-extractor-utils/ @discordjs/api-extractor-utils
|
||||
/packages/brokers/ @discordjs/brokers
|
||||
/packages/builders/ @discordjs/builders
|
||||
|
||||
@@ -62,7 +62,7 @@ body:
|
||||
description: List necessary versions here. This includes your package version, runtime version, operating system etc.
|
||||
placeholder: |
|
||||
- discord.js 14.12.1 (`npm ls discord.js` or another package)
|
||||
- Node.js 22.12.0 (`node --version`)
|
||||
- Node.js 16.11.0 (`node --version`)
|
||||
- TypeScript 5.1.6 (`npm ls typescript` if you use it)
|
||||
- macOS Ventura 13.3.1
|
||||
validations:
|
||||
@@ -107,7 +107,7 @@ body:
|
||||
- Guilds
|
||||
- GuildMembers
|
||||
- GuildModeration
|
||||
- GuildExpressions
|
||||
- GuildEmojisAndStickers
|
||||
- GuildIntegrations
|
||||
- GuildWebhooks
|
||||
- GuildInvites
|
||||
|
||||
4
.github/labels.yml
vendored
@@ -10,8 +10,6 @@
|
||||
color: 7ef7ef
|
||||
- name: backport
|
||||
color: 88aabb
|
||||
- name: backport-candidate
|
||||
color: 0075ca
|
||||
- name: blocked
|
||||
color: fc1423
|
||||
- name: bug
|
||||
@@ -40,6 +38,8 @@
|
||||
color: 80c042
|
||||
- name: good first issue
|
||||
color: 7057ff
|
||||
- name: has PR
|
||||
color: 4b1f8e
|
||||
- name: help wanted
|
||||
color: '008672'
|
||||
- name: in progress
|
||||
|
||||
34
.github/workflows/deploy-website.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Deploy website
|
||||
on:
|
||||
workflow_dispatch:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
deploy-website:
|
||||
name: Deploy website
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
if: github.repository_owner == 'discordjs'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Pull vercel production environment
|
||||
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Build website artifacts
|
||||
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Deploy website artifacts to vercel
|
||||
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||
4
.github/workflows/deprecate-version.yml
vendored
@@ -36,10 +36,10 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
11
.github/workflows/documentation.yml
vendored
@@ -40,10 +40,10 @@ jobs:
|
||||
with:
|
||||
ref: ${{ inputs.ref || '' }}
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
@@ -60,11 +60,8 @@ jobs:
|
||||
- name: Build main
|
||||
if: ${{ inputs.ref && inputs.ref != 'main' }}
|
||||
shell: bash
|
||||
env:
|
||||
COREPACK_ENABLE_STRICT: 0
|
||||
run: |
|
||||
cd main
|
||||
pnpm self-update 10
|
||||
pnpm install --frozen-lockfile --prefer-offline --loglevel error
|
||||
pnpm run build
|
||||
cd ..
|
||||
@@ -264,10 +261,10 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
4
.github/workflows/publish-dev-docker.yml
vendored
@@ -12,10 +12,10 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
4
.github/workflows/publish-dev.yml
vendored
@@ -47,10 +47,10 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Check the current development version
|
||||
|
||||
4
.github/workflows/publish-docker.yml
vendored
@@ -9,10 +9,10 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
4
.github/workflows/publish-release.yml
vendored
@@ -16,10 +16,10 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Install dependencies
|
||||
|
||||
4
.github/workflows/tests.yml
vendored
@@ -19,10 +19,10 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v22
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
6
.npmrc
Normal file
@@ -0,0 +1,6 @@
|
||||
auto-install-peers=false
|
||||
resolution-mode=highest
|
||||
public-hoist-pattern[]=*eslint*
|
||||
public-hoist-pattern[]=*prettier*
|
||||
public-hoist-pattern[]=*@rushstack/node-core-library*
|
||||
public-hoist-pattern[]=*jju*
|
||||
44
.vscode/settings.json
vendored
@@ -1,57 +1,31 @@
|
||||
{
|
||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
|
||||
"eslint.useESLintClass": true,
|
||||
"eslint.useFlatConfig": true,
|
||||
"eslint.workingDirectories": [{ "directory": "${workspaceFolder}" }, { "pattern": "./packages/*/" }],
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "never",
|
||||
"source.fixAll.eslint": "always",
|
||||
"source.fixAll": "always"
|
||||
"source.fixAll.eslint": "explicit",
|
||||
"source.fixAll": "explicit"
|
||||
},
|
||||
"editor.trimAutoWhitespace": false,
|
||||
"files.associations": {
|
||||
"api-extractor.json": "jsonc",
|
||||
"api-extractor-docs.json": "jsonc",
|
||||
"tsconfig.json": "jsonc",
|
||||
"tsconfig.eslint.json": "jsonc"
|
||||
"tsconfig.eslint.json": "jsonc",
|
||||
"tsconfig.docs.json": "jsonc"
|
||||
},
|
||||
"files.insertFinalNewline": true,
|
||||
"files.eol": "\n",
|
||||
"search.exclude": {
|
||||
"**/.yarn": true,
|
||||
"**/.next": true,
|
||||
"**/dist": true,
|
||||
"**/coverage": true,
|
||||
"**/test-results": true
|
||||
},
|
||||
"search.followSymlinks": false,
|
||||
"search.useParentIgnoreFiles": true,
|
||||
"files.watcherExclude": {
|
||||
"**/.next/*/**": true,
|
||||
"**/.yarn/*/**": true,
|
||||
"**/coverage/*/**": true,
|
||||
"**/dist/*/**": true,
|
||||
"**/test-results/*/**": true
|
||||
},
|
||||
"unocss.disable": true,
|
||||
"npm.packageManager": "pnpm",
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||
"tailwindCSS.experimental.classRegex": [
|
||||
["cva\\(((?:[^()]|\\([^()]*\\))*)\\)", "[\"'`]?([^\"'`]+)[\"'`]?"],
|
||||
["cx\\(((?:[^()]|\\([^()]*\\))*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
|
||||
["class:\\s*?[\"'`]([^\"'`]*).*?,"]
|
||||
],
|
||||
"workbench.editor.customLabels.patterns": {
|
||||
"**/app/**/page.tsx": "${dirname} (${filename}.${extname}) - Page",
|
||||
"**/app/**/layout.tsx": "${dirname} (${filename}.${extname}) - Layout",
|
||||
"**/app/**/template.tsx": "${dirname} (${filename}.${extname}) - Template",
|
||||
"**/app/**/error.tsx": "${dirname} (${filename}.${extname}) - Error",
|
||||
"**/app/**/not-found.tsx": "${dirname} (${filename}.${extname}) - Not Found",
|
||||
"**/components/**/page.tsx": "${dirname} (${filename}.${extname}) - Component"
|
||||
},
|
||||
"unocss.disable": true,
|
||||
"deno.enable": false,
|
||||
"deno.enablePaths": ["./packages/create-discord-bot/template/Deno"],
|
||||
"deno.lint": false,
|
||||
"deno.unstable": false,
|
||||
"deno.unstable": [],
|
||||
"deno.config": "./packages/create-discord-bot/template/Deno/deno.jsonc"
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
NEXT_PUBLIC_LOCAL_DEV=true
|
||||
31
apps/website/.gitignore
vendored
@@ -1,31 +0,0 @@
|
||||
# Packages
|
||||
node_modules
|
||||
|
||||
# Log files
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Env
|
||||
.env
|
||||
.env*.local
|
||||
|
||||
# Dist
|
||||
.next
|
||||
public/searchIndex
|
||||
src/assets/readme
|
||||
src/styles/unocss.css
|
||||
|
||||
# Miscellaneous
|
||||
.tmp
|
||||
.vscode
|
||||
lighthouse-results
|
||||
|
||||
.vercel
|
||||
|
||||
old_src
|
||||
@@ -1,2 +0,0 @@
|
||||
/** @type {import('lint-staged').Config} */
|
||||
module.exports = require('../../.lintstagedrc.json');
|
||||
@@ -1,9 +0,0 @@
|
||||
.next
|
||||
.turbo
|
||||
.vscode
|
||||
coverage
|
||||
public/searchIndex
|
||||
src/assets/readme
|
||||
src/styles/unocss.css
|
||||
next-env.d.ts
|
||||
src/util/shiki.bundle.ts
|
||||
@@ -1,6 +0,0 @@
|
||||
/** @type {import('prettier').Config} */
|
||||
module.exports = {
|
||||
...require('../../.prettierrc.json'),
|
||||
plugins: ['prettier-plugin-tailwindcss'],
|
||||
tailwindFunctions: ['cva', 'cx'],
|
||||
};
|
||||
@@ -1,190 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2022 Noel Buechler
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,48 +0,0 @@
|
||||
<div align="center">
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
||||
<a href="https://www.cloudflare.com"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-workers.png" alt="Cloudflare Workers" height="44" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## Links
|
||||
|
||||
- [Website][website] ([source][website-source])
|
||||
- [Documentation][documentation]
|
||||
- [Guide][guide] ([source][guide-source])
|
||||
Also see the v13 to v14 [Update Guide][guide-update], which includes updated and removed items from the library.
|
||||
- [discord.js Discord server][discord]
|
||||
- [Discord API Discord server][discord-api]
|
||||
- [GitHub][source]
|
||||
- [Related libraries][related-libs]
|
||||
|
||||
## Contributing
|
||||
|
||||
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
|
||||
[documentation][documentation].
|
||||
See [the contribution guide][contributing] if you'd like to submit a PR.
|
||||
|
||||
## Help
|
||||
|
||||
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official [discord.js Server][discord].
|
||||
|
||||
[website]: https://discord.js.org
|
||||
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
|
||||
[documentation]: https://discord.js.org/docs
|
||||
[guide]: https://discordjs.guide/
|
||||
[guide-source]: https://github.com/discordjs/guide
|
||||
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html
|
||||
[discord]: https://discord.gg/djs
|
||||
[discord-api]: https://discord.gg/discord-api
|
||||
[source]: https://github.com/discordjs/discord.js/tree/main/apps/website
|
||||
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
|
||||
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md
|
||||
5
apps/website/next-env.d.ts
vendored
@@ -1,5 +0,0 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
@@ -1,48 +0,0 @@
|
||||
import type { NextConfig } from 'next';
|
||||
|
||||
export default {
|
||||
reactStrictMode: true,
|
||||
images: {
|
||||
dangerouslyAllowSVG: true,
|
||||
contentDispositionType: 'attachment',
|
||||
contentSecurityPolicy: "default-src 'self'; frame-src 'none'; sandbox;",
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: 'http',
|
||||
hostname: 'localhost',
|
||||
},
|
||||
],
|
||||
},
|
||||
poweredByHeader: false,
|
||||
logging: {
|
||||
fetches: {
|
||||
fullUrl: true,
|
||||
},
|
||||
},
|
||||
experimental: {
|
||||
ppr: true,
|
||||
reactCompiler: true,
|
||||
useCache: true,
|
||||
dynamicOnHover: true,
|
||||
},
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
source: '/static/logo.svg',
|
||||
destination: '/logo.svg',
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: '/guide/:path*',
|
||||
destination: 'https://next.discordjs.guide/guide/:path*',
|
||||
permanent: true,
|
||||
},
|
||||
];
|
||||
},
|
||||
} satisfies NextConfig;
|
||||
@@ -1,125 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@discordjs/website",
|
||||
"version": "0.1.0",
|
||||
"description": "Imagine a bot... the most popular way to build discord bots",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build:copy_readme": "cpy \"../../packages/(discord.js|brokers|builders|collection|core|formatters|next|proxy|rest|util|voice|ws)/README.md\" \"src/assets/readme\" --rename='home-{{basename}}'",
|
||||
"build:check": "tsc --noEmit",
|
||||
"build:local": "cross-env NEXT_PUBLIC_LOCAL_DEV=true pnpm run build:prod",
|
||||
"build:prod": "pnpm run build:copy_readme && pnpm run build:next",
|
||||
"build:next": "next build",
|
||||
"build:search_indices": "pnpm node scripts/generateAllIndices.js",
|
||||
"build:analyze": "turbo run docs --filter='@discordjs/*' --concurrency=4 && cross-env ANALYZE=true NEXT_PUBLIC_LOCAL_DEV=true pnpm run build:prod",
|
||||
"preview": "next start",
|
||||
"dev": "next dev --turbopack",
|
||||
"lint": "pnpm run build:check && prettier --check . && cross-env TIMING=1 eslint --format=pretty src ",
|
||||
"format": "pnpm run build:check && prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src ",
|
||||
"fmt": "pnpm run format"
|
||||
},
|
||||
"type": "module",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
},
|
||||
"contributors": [
|
||||
"Crawl <icrawltogo@gmail.com>"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"keywords": [
|
||||
"discord",
|
||||
"api",
|
||||
"bot",
|
||||
"client",
|
||||
"node",
|
||||
"discordapp",
|
||||
"discordjs"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/discordjs/discord.js.git",
|
||||
"directory": "apps/website"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/discordjs/discord.js/issues"
|
||||
},
|
||||
"homepage": "https://discord.js.org",
|
||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-collapsible": "^1.1.3",
|
||||
"@react-icons/all-files": "^4.1.0",
|
||||
"@vercel/analytics": "^1.5.0",
|
||||
"@vercel/edge-config": "^1.4.0",
|
||||
"@vercel/og": "^0.6.8",
|
||||
"@vercel/postgres": "^0.10.0",
|
||||
"cmdk": "^1.1.1",
|
||||
"cva": "1.0.0-beta.3",
|
||||
"geist": "^1.3.1",
|
||||
"immer": "^10.1.1",
|
||||
"jotai": "^2.12.2",
|
||||
"jotai-immer": "^0.4.1",
|
||||
"lucide-react": "^0.487.0",
|
||||
"meilisearch": "^0.49.0",
|
||||
"motion": "^12.6.3",
|
||||
"next": "15.3.1-canary.2",
|
||||
"next-mdx-remote-client": "^2.1.1",
|
||||
"next-themes": "^0.4.6",
|
||||
"nuqs": "^2.4.1",
|
||||
"overlayscrollbars": "^2.11.1",
|
||||
"overlayscrollbars-react": "^0.5.6",
|
||||
"react": "^19.1.0",
|
||||
"react-aria": "^3.38.1",
|
||||
"react-aria-components": "^1.7.1",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-error-boundary": "^5.0.0",
|
||||
"sharp": "^0.33.5",
|
||||
"tailwind-merge": "^3.1.0",
|
||||
"tw-animate-css": "^1.2.5",
|
||||
"usehooks-ts": "^3.1.1",
|
||||
"vaul": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/env": "^15.2.4",
|
||||
"@playwright/test": "^1.51.1",
|
||||
"@shikijs/rehype": "^3.2.1",
|
||||
"@tailwindcss/postcss": "^4.1.3",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@tailwindcss/vite": "^4.1.3",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/node": "^22.14.0",
|
||||
"@types/react": "^19.1.0",
|
||||
"@types/react-dom": "^19.1.1",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitest/browser": "^3.1.1",
|
||||
"@vitest/coverage-v8": "^2.1.8",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"babel-plugin-react-compiler": "19.0.0-beta-e993439-20250328",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^9.24.0",
|
||||
"eslint-config-neon": "^0.2.7",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"git-describe": "^4.1.1",
|
||||
"happy-dom": "^17.4.4",
|
||||
"msw": "^2.7.3",
|
||||
"playwright": "^1.51.1",
|
||||
"postcss": "^8.5.3",
|
||||
"prettier": "^3.5.3",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"remark-rehype": "^11.1.2",
|
||||
"shiki": "^3.2.1",
|
||||
"tailwindcss": "^4.1.3",
|
||||
"tailwindcss-react-aria-components": "^2.0.0",
|
||||
"turbo": "^2.5.0",
|
||||
"typescript": "^5.8.2",
|
||||
"vercel": "^41.4.1",
|
||||
"vite-tsconfig-paths": "^5.1.4",
|
||||
"vitest": "^2.1.8",
|
||||
"vitest-browser-react": "^0.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export default {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {},
|
||||
},
|
||||
};
|
||||
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="/mstile-70x70.png"/>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<square310x310logo src="/mstile-310x310.png"/>
|
||||
<wide310x150logo src="/mstile-310x150.png"/>
|
||||
<TileColor>#090a16</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
|
Before Width: | Height: | Size: 561 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 15 KiB |
@@ -1,35 +0,0 @@
|
||||
<svg width="5232" height="945" viewBox="0 0 5232 945" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_dd)">
|
||||
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="3979" y="20" width="1245" height="907">
|
||||
<path d="M4685.1 692.37C4747.89 751.167 4832.06 791.257 4913.55 791.257C5011.09 791.257 5065.87 747.156 5065.87 679.006C5065.87 606.85 5009.75 584.134 4929.59 550.728L4810.68 498.614C4723.84 462.533 4634.33 394.383 4634.33 266.097C4634.33 127.126 4757.25 20.2217 4926.92 20.2217C5029.79 20.2217 5128.66 62.9858 5196.8 131.136L5116.63 230.019C5061.85 183.252 5001.74 155.187 4926.92 155.187C4844.08 155.187 4790.64 193.941 4790.64 258.082C4790.64 326.232 4857.45 351.623 4929.59 381.019L5047.17 430.464C5151.37 474.558 5223.51 540.035 5223.51 666.98C5223.51 808.627 5105.94 926.221 4909.56 926.221C4791.98 926.221 4678.42 879.451 4595.59 797.937L4685.1 692.37Z" fill="white"/>
|
||||
<path d="M4362.62 20.2217H4514.42V625.218C4514.42 785.559 4419.32 925.689 4236.89 925.689C4112.78 933.776 4006.36 848.244 3979.19 761.134C4001.8 757.707 4023.82 754.196 4051.3 745.549C4073.15 738.673 4105.83 723.903 4105.83 723.903C4130.43 763.127 4173.98 789.193 4223.6 789.193C4300.39 789.193 4362.64 726.761 4362.64 649.746L4362.62 20.2217Z" fill="white"/>
|
||||
</mask>
|
||||
<g mask="url(#mask0)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3958.82 72.292L4012.02 47.467C4066.83 24.1022 4174.84 -22.6272 4282.85 -34.3096C4390.86 -45.992 4498.87 -22.6272 4606.88 -28.4684C4713.28 -34.3096 4821.29 -69.3567 4929.3 -45.992C5037.31 -22.6272 5145.32 59.1493 5200.14 101.498L5253.33 142.386V247.527H5200.14C5145.32 247.527 5037.31 247.527 4929.3 247.527C4821.29 247.527 4713.28 247.527 4606.88 247.527C4498.87 247.527 4390.86 247.527 4282.85 247.527C4174.84 247.527 4066.83 247.527 4012.02 247.527H3958.82V72.292Z" fill="#FF5C5C"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3958.82 76.645L4012.02 115.335C4066.83 154.026 4174.84 233.019 4282.85 233.019C4390.86 233.019 4498.87 154.026 4606.88 128.232C4713.28 102.439 4821.29 128.232 4929.3 141.129C5037.31 154.026 5145.32 154.026 5200.14 154.026H5253.33V426.47H5200.14C5145.32 426.47 5037.31 426.47 4929.3 426.47C4821.29 426.47 4713.28 426.47 4606.88 426.47C4498.87 426.47 4390.86 426.47 4282.85 426.47C4174.84 426.47 4066.83 426.47 4012.02 426.47H3958.82V76.645Z" fill="#F79454"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3958.82 247.527L4012.02 265.951C4066.83 284.375 4174.84 321.223 4282.85 321.223C4390.86 321.223 4498.87 284.375 4606.88 275.163C4713.28 265.951 4821.29 284.375 4929.3 316.617C5037.31 348.859 5145.32 396.071 5200.14 419.101L5253.33 442.131V497.403H5200.14C5145.32 497.403 5037.31 497.403 4929.3 497.403C4821.29 497.403 4713.28 497.403 4606.88 497.403C4498.87 497.403 4390.86 497.403 4282.85 497.403C4174.84 497.403 4066.83 497.403 4012.02 497.403H3958.82V247.527Z" fill="#FFDB5C"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3958.82 407.125L4012.76 420.44C4066.7 433.755 4174.57 460.384 4282.45 460.384C4390.32 460.384 4498.2 433.755 4606.08 440.412C4713.95 447.07 4821.83 487.014 4929.71 487.014C5037.58 487.014 5145.46 447.07 5199.4 427.098L5253.33 407.125V766.624H5199.4C5145.46 766.624 5037.58 766.624 4929.71 766.624C4821.83 766.624 4713.95 766.624 4606.08 766.624C4498.2 766.624 4390.32 766.624 4282.45 766.624C4174.57 766.624 4066.7 766.624 4012.76 766.624H3958.82V407.125Z" fill="#5CFF9D"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5253.34 600.577L5200.14 613.169C5145.33 625.76 5037.31 650.943 4929.3 644.648C4821.29 638.352 4713.28 600.577 4605.27 600.577C4498.87 600.577 4390.86 638.352 4282.85 657.239C4174.84 677.7 4066.83 677.7 4012.02 677.7H3958.82V866.573H4012.02C4066.83 866.573 4174.84 866.573 4282.85 866.573C4390.86 866.573 4498.87 866.573 4605.27 866.573C4713.28 866.573 4821.29 866.573 4929.3 866.573C5037.31 866.573 5145.33 866.573 5200.14 866.573H5253.34V600.577Z" fill="#5C6CFF"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3958.82 760.175L4090.21 692.467C4132.12 760.175 4174.84 794.363 4282.85 798.637C4390.86 802.91 4498.87 772.266 4606.88 772.266C4713.28 772.266 4821.29 802.91 4929.3 798.637C5037.31 794.363 5179.98 760.175 5229.96 740.024L5253.33 760.175V940.73H5200.14C5145.32 940.73 5037.31 940.73 4929.3 940.73C4821.29 940.73 4713.28 940.73 4606.88 940.73C4498.87 940.73 4390.86 940.73 4282.85 940.73C4174.84 940.73 4066.83 940.73 4012.02 940.73H3958.82V760.175Z" fill="#B75CFF"/>
|
||||
</g>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4264.21 348.906C4264.21 282.978 4251.78 225.648 4226.94 175.965C4201.14 127.234 4163.88 89.0164 4114.19 61.3076C4064.51 33.5989 4004.32 20.2217 3932.65 20.2217H3667.03V689.056H3892.98H3920.23C3986.6 689.056 4037.45 678.548 4084.65 654.747C4084.59 653.088 4084.57 651.421 4084.57 649.746C4084.57 572.732 4146.82 510.3 4223.61 510.3C4225.89 510.3 4228.16 510.355 4230.41 510.464C4254.5 461.424 4264.21 412.805 4264.21 348.906ZM3827.55 163.544V545.734H3918.32C3976.61 545.734 4020.56 528.534 4050.18 493.183C4079.8 458.785 4095.08 411.967 4095.08 351.772C4095.08 292.533 4080.75 246.67 4052.09 213.229C4023.42 179.786 3980.43 163.544 3924.05 163.544H3827.55Z" fill="#5865F2"/>
|
||||
<path d="M4311.87 649.747C4311.87 698.271 4272.53 737.606 4224.01 737.606C4175.49 737.606 4136.15 698.271 4136.15 649.747C4136.15 601.222 4175.49 561.887 4224.01 561.887C4272.53 561.887 4311.87 601.222 4311.87 649.747Z" fill="#5865F2"/>
|
||||
<path d="M261.386 689.469C335.011 689.469 398.119 675.125 449.752 645.481C501.386 616.793 540.589 576.63 566.405 524.991C592.222 474.309 605.609 415.02 605.609 349.038C605.609 283.055 593.178 225.679 568.318 175.953C542.501 127.184 505.21 88.933 455.489 61.2012C405.768 33.4694 345.529 20.0816 273.816 20.0816H8V689.469H261.386ZM168.637 546.029V163.522H265.211C321.625 163.522 364.653 179.778 393.338 213.248C422.023 246.717 436.366 292.618 436.366 351.907C436.366 412.152 421.067 459.009 391.426 493.434C361.784 528.816 317.8 546.029 259.474 546.029H168.637ZM878.299 20.0816H717.662V689.469H878.299V20.0816ZM1237.12 709.551C1316.48 709.551 1379.59 690.426 1425.48 651.219C1470.42 612.968 1493.37 560.373 1493.37 494.391C1493.37 444.665 1479.03 403.545 1450.34 371.032C1421.66 339.475 1375.76 312.7 1311.7 292.618L1242.85 270.624C1217.04 260.105 1198.87 249.586 1187.4 239.067C1174.97 228.548 1169.23 216.117 1169.23 199.86C1169.23 159.697 1200.78 139.615 1264.85 139.615C1332.74 139.615 1397.76 161.609 1460.86 206.554V59.2886C1393.93 20.0816 1323.17 0 1247.64 0C1170.19 0 1108.99 18.1691 1065.01 54.5072C1021.02 91.8017 999.031 141.528 999.031 205.598C999.031 253.411 1012.42 292.618 1038.23 323.219C1064.05 354.775 1106.12 379.638 1163.49 399.72L1241.9 425.539C1269.63 437.014 1288.75 447.534 1299.27 458.052C1309.79 468.571 1314.57 482.915 1314.57 499.172C1314.57 545.073 1283.01 568.023 1218.95 568.023C1180.7 568.023 1142.46 560.373 1103.25 546.029C1064.05 531.685 1029.63 513.516 999.031 489.609V638.787C1070.74 685.644 1150.11 709.551 1237.12 709.551ZM1921.29 708.595C1962.43 708.595 2002.57 702.857 2039.85 692.338C2077.17 681.819 2109.67 667.475 2137.39 649.306V502.997C2112.53 520.21 2084.8 533.598 2053.26 544.116C2021.69 554.635 1990.15 560.373 1957.64 560.373C1912.69 560.373 1872.53 551.767 1839.06 533.598C1805.6 516.385 1779.78 492.478 1761.61 460.921C1743.45 429.364 1733.89 393.982 1733.89 353.819C1733.89 313.656 1743.45 278.274 1761.61 246.717C1779.78 215.16 1805.6 191.254 1839.06 174.041C1872.53 156.828 1910.77 148.221 1955.72 148.221C2020.73 148.221 2080.02 168.303 2134.54 207.51V55.4635C2072.39 19.1253 2002.57 0.956277 1923.22 0.956277C1851.49 0.956277 1788.39 16.2564 1734.84 46.857C1680.34 77.4576 1639.22 119.533 1609.58 174.041C1579.94 228.548 1565.6 289.749 1565.6 358.601C1565.6 423.627 1579.94 482.915 1607.67 535.51C1635.4 589.061 1676.51 631.137 1730.06 661.737C1783.61 693.294 1847.67 708.595 1921.29 708.595ZM2561.67 708.595C2629.56 708.595 2689.82 693.294 2743.34 663.65C2795.93 634.006 2838.02 591.93 2867.64 538.379C2897.29 484.828 2911.63 423.627 2911.63 355.732C2911.63 287.837 2897.29 226.635 2867.64 172.128C2838.02 118.577 2795.93 76.5013 2743.34 45.9007C2689.82 16.2564 2629.56 0.956277 2561.67 0.956277C2494.73 0.956277 2434.51 16.2564 2381.92 45.9007C2329.33 76.5013 2288.22 118.577 2258.58 172.128C2228.93 226.635 2213.62 287.837 2213.62 355.732C2213.62 423.627 2228.93 484.828 2258.58 538.379C2288.22 591.93 2329.33 634.006 2381.92 663.65C2434.51 693.294 2494.73 708.595 2561.67 708.595ZM2561.67 556.548C2525.34 556.548 2493.8 547.942 2467.01 530.729C2439.29 513.516 2418.24 489.609 2403.9 459.009C2389.56 429.364 2381.92 394.939 2381.92 356.688C2381.92 318.437 2389.56 284.012 2403.9 252.455C2418.24 221.854 2439.29 197.948 2467.01 179.778C2493.8 161.609 2525.34 153.003 2561.67 153.003C2598.98 153.003 2630.52 161.609 2658.25 179.778C2685.97 197.948 2707.02 221.854 2721.36 252.455C2735.7 284.012 2742.41 318.437 2742.41 356.688C2742.41 394.939 2734.74 429.364 2720.4 459.009C2706.05 489.609 2685.04 513.516 2658.25 530.729C2630.52 547.942 2598.98 556.548 2561.67 556.548ZM3373.13 419.802C3431.46 413.108 3475.42 392.07 3507 357.644C3538.54 323.219 3553.84 279.23 3553.84 226.635C3553.84 162.565 3532.8 112.84 3489.77 75.5452C3446.74 38.2507 3388.44 20.0816 3315.76 20.0816H3021.24V689.469H3181.9V407.37L3379.81 689.469H3572L3373.13 419.802ZM3181.9 154.915H3285.15C3316.72 154.915 3340.63 162.566 3356.87 176.91C3373.13 192.21 3381.73 214.204 3381.73 241.936C3381.73 271.58 3372.17 293.574 3354.01 309.831C3335.85 326.087 3309.06 333.738 3273.7 333.738H3181.9V154.915Z" fill="#5865F2"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_dd" x="0" y="0" width="5232" height="945" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feOffset dy="10"/>
|
||||
<feGaussianBlur stdDeviation="4"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feOffset dy="4"/>
|
||||
<feGaussianBlur stdDeviation="1.5"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
|
||||
<feBlend mode="normal" in2="effect1_dropShadow" result="effect2_dropShadow"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 68 KiB |
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="400.000000pt" height="400.000000pt" viewBox="0 0 400.000000 400.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,400.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M0 2000 l0 -2000 2000 0 2000 0 0 2000 0 2000 -2000 0 -2000 0 0
|
||||
-2000z m1305 795 c219 -47 373 -197 421 -411 24 -109 16 -315 -16 -399 l-23
|
||||
-61 -59 -11 c-110 -21 -182 -92 -203 -202 -11 -56 -11 -56 -68 -79 -76 -30
|
||||
-201 -42 -464 -42 l-223 0 0 610 0 610 283 0 c210 0 300 -4 352 -15z m890
|
||||
-585 c0 -543 -2 -601 -18 -659 -56 -198 -190 -334 -365 -370 -176 -37 -349 5
|
||||
-471 115 -48 44 -111 134 -111 161 0 6 19 14 43 18 23 4 73 18 110 32 l68 24
|
||||
50 -45 c56 -50 98 -66 175 -66 100 0 207 81 234 178 6 23 10 251 10 625 l0
|
||||
588 138 -3 137 -3 0 -595z m930 570 c93 -29 197 -84 252 -134 l44 -41 -61 -75
|
||||
c-34 -41 -67 -81 -74 -88 -10 -10 -25 -4 -78 32 -95 63 -154 81 -268 81 -79 0
|
||||
-103 -4 -142 -23 -62 -31 -90 -71 -96 -137 -8 -94 28 -137 168 -202 157 -73
|
||||
172 -80 240 -108 236 -97 341 -215 356 -400 16 -193 -82 -363 -258 -449 -91
|
||||
-45 -187 -66 -303 -66 -191 0 -390 74 -524 195 l-40 37 80 93 80 94 73 -53
|
||||
c168 -121 353 -155 491 -92 72 33 108 82 113 155 9 122 -37 162 -323 286 -258
|
||||
111 -350 179 -407 300 -69 148 -37 343 75 463 61 65 195 133 300 152 79 14
|
||||
222 4 302 -20z m-1367 -977 c45 -34 65 -69 70 -125 4 -61 -19 -106 -77 -145
|
||||
-90 -60 -226 3 -238 111 -3 24 -3 56 1 70 8 34 54 86 91 102 40 19 120 12 153
|
||||
-13z"/>
|
||||
<path d="M967 2543 c-4 -3 -7 -159 -7 -346 l0 -339 128 4 c101 3 136 8 172 24
|
||||
106 48 162 145 168 292 10 214 -69 334 -238 361 -73 12 -213 15 -223 4z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "discord.js",
|
||||
"short_name": "discord.js",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#1a1b1e",
|
||||
"background_color": "#1a1b1e",
|
||||
"display": "standalone"
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { generateAllIndices } from '@discordjs/scripts';
|
||||
|
||||
console.log('Generating all indices...');
|
||||
await generateAllIndices({
|
||||
fetchPackageVersions: async (pkg) => {
|
||||
return ['main'];
|
||||
},
|
||||
fetchPackageVersionDocs: async (pkg, version) => {
|
||||
console.log(`Fetching data for ${pkg} ${version}...`);
|
||||
return JSON.parse(await readFile(`${process.cwd()}/../../../docs/${pkg}/${version}.api.json`, 'utf8'));
|
||||
},
|
||||
});
|
||||
console.log('Generated all indices.');
|
||||
@@ -1,14 +0,0 @@
|
||||
import { CmdKNoSRR } from '@/components/CmdK';
|
||||
import { fetchDependencies } from '@/util/fetchDependencies';
|
||||
|
||||
export async function CmdK({
|
||||
params,
|
||||
}: {
|
||||
readonly params: Promise<{ readonly packageName: string; readonly version: string }>;
|
||||
}) {
|
||||
const { packageName, version } = await params;
|
||||
|
||||
const dependencies = await fetchDependencies({ packageName, version });
|
||||
|
||||
return <CmdKNoSRR dependencies={dependencies} />;
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/* eslint-disable react/no-unknown-property */
|
||||
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { resolveKind } from '@/util/resolveNodeKind';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
export const size = {
|
||||
width: 1_200,
|
||||
height: 630,
|
||||
};
|
||||
|
||||
export const contentType = 'image/png';
|
||||
|
||||
export default async function Image({
|
||||
params,
|
||||
}: {
|
||||
readonly params: Promise<{ readonly item: string; readonly packageName: string; readonly version: string }>;
|
||||
}) {
|
||||
const { item, packageName, version } = await params;
|
||||
|
||||
const [fontDataBold, fontDataBlack] = await Promise.all([
|
||||
fetch(new URL('../../../../../../assets/Geist-Bold.ttf', import.meta.url), {
|
||||
next: { revalidate: 604_800 },
|
||||
}).then(async (res) => res.arrayBuffer()),
|
||||
fetch(new URL('../../../../../../assets/Geist-Black.ttf', import.meta.url), {
|
||||
next: { revalidate: 604_800 },
|
||||
}).then(async (res) => res.arrayBuffer()),
|
||||
]);
|
||||
const normalizeItem = item.split(encodeURIComponent(':')).join('.').toLowerCase();
|
||||
|
||||
const isMain = version === 'main';
|
||||
const fileContent = await fetch(
|
||||
`${process.env.BLOB_STORAGE_URL}/rewrite/${packageName}/${version}.${normalizeItem}.api.json`,
|
||||
{ next: { revalidate: isMain ? 0 : 604_800 } },
|
||||
);
|
||||
const node = await fileContent.json();
|
||||
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div tw="flex bg-[#121212] h-full w-full p-14">
|
||||
<div tw="flex flex-col mx-auto h-full text-white">
|
||||
<div tw="flex text-4xl text-gray-400">{packageName}</div>
|
||||
<div tw="flex flex-col justify-between h-full w-full pt-14">
|
||||
<div tw="flex items-center max-w-full">
|
||||
<span tw="mr-6">{resolveKind(node.kind, 94)}</span>
|
||||
<h2
|
||||
style={{
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
tw="text-[5.5rem] font-bold w-full"
|
||||
>
|
||||
{node.displayName}
|
||||
</h2>
|
||||
</div>
|
||||
<div tw="flex flex-row w-full justify-between">
|
||||
<div tw="flex flex-row">
|
||||
{node.members?.properties?.length ? (
|
||||
<div tw="flex mr-12">
|
||||
<span tw="mr-4">{resolveKind('Property', 42)}</span>
|
||||
<div tw="flex flex-col text-4xl">
|
||||
<span tw="mb-4">{node.members.properties.length}</span>
|
||||
<span>Properties</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{node.members?.events?.length ? (
|
||||
<div tw="flex mr-12">
|
||||
<span tw="mr-4">{resolveKind('Method', 42)}</span>
|
||||
<div tw="flex flex-col text-4xl">
|
||||
<span tw="mb-4">{node.members.events.length}</span>
|
||||
<span>Events</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{node.members?.methods?.length ? (
|
||||
<div tw="flex mr-12">
|
||||
<span tw="mr-4">{resolveKind('Method', 42)}</span>
|
||||
<div tw="flex flex-col text-4xl">
|
||||
<span tw="mb-4">{node.members.methods.length}</span>
|
||||
<span>Methods</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{node.members?.length ? (
|
||||
<div tw="flex">
|
||||
<span tw="mr-4">{resolveKind('EnumMember', 42)}</span>
|
||||
<div tw="flex flex-col text-4xl">
|
||||
<span tw="mb-4">{node.members.length}</span>
|
||||
<span>Members</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div tw="flex h-full items-end">
|
||||
<span tw="bg-[#5865f2] text-4xl font-black relative rounded-lg py-4 px-8">discord.js</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
{
|
||||
...size,
|
||||
fonts: [
|
||||
{
|
||||
name: 'Geist',
|
||||
data: fontDataBold,
|
||||
weight: 700,
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
name: 'Geist',
|
||||
data: fontDataBlack,
|
||||
weight: 900,
|
||||
style: 'normal',
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
'use cache';
|
||||
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { DocItem } from '@/components/DocItem';
|
||||
import { fetchNode } from '@/util/fetchNode';
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
readonly params: Promise<{
|
||||
readonly item: string;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}>;
|
||||
}): Promise<Metadata> {
|
||||
const { item, packageName, version } = await params;
|
||||
|
||||
const normalizeItem = item.split(encodeURIComponent(':'))[0];
|
||||
|
||||
return {
|
||||
title: `${normalizeItem} (${packageName} - ${version})`,
|
||||
};
|
||||
}
|
||||
|
||||
export default async function Page({
|
||||
params,
|
||||
}: {
|
||||
readonly params: Promise<{ readonly item: string; readonly packageName: string; readonly version: string }>;
|
||||
}) {
|
||||
const { item, packageName, version } = await params;
|
||||
|
||||
const node = await fetchNode({ item, packageName, version });
|
||||
|
||||
if (!node) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex w-full max-w-screen-xl flex-col gap-8 px-6 py-4">
|
||||
<DocItem node={node} packageName={packageName} version={version} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
'use cache';
|
||||
|
||||
import { VscGithubInverted } from '@react-icons/all-files/vsc/VscGithubInverted';
|
||||
import type { Metadata } from 'next';
|
||||
import Link from 'next/link';
|
||||
import { Suspense, type PropsWithChildren } from 'react';
|
||||
import { Footer } from '@/components/Footer';
|
||||
import { Navigation } from '@/components/Navigation';
|
||||
import { Scrollbars } from '@/components/OverlayScrollbars';
|
||||
import { PackageSelect } from '@/components/PackageSelect';
|
||||
import { SearchButton } from '@/components/SearchButton';
|
||||
import { ThemeSwitchNoSRR } from '@/components/ThemeSwitch';
|
||||
import { VersionSelect } from '@/components/VersionSelect';
|
||||
import { Sidebar, SidebarContent, SidebarHeader, SidebarInset, SidebarTrigger } from '@/components/ui/Sidebar';
|
||||
import { buttonStyles } from '@/styles/ui/button';
|
||||
import { ENV } from '@/util/env';
|
||||
import { fetchVersions } from '@/util/fetchVersions';
|
||||
import { CmdK } from './CmdK';
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
readonly params: Promise<{ readonly packageName: string; readonly version: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { packageName, version } = await params;
|
||||
|
||||
return {
|
||||
title: {
|
||||
template: '%s | discord.js',
|
||||
default: `${packageName} (${version})`,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default async function Layout({
|
||||
params,
|
||||
children,
|
||||
}: PropsWithChildren<{ readonly params: Promise<{ readonly packageName: string; readonly version: string }> }>) {
|
||||
const { packageName, version } = await params;
|
||||
|
||||
const versions = fetchVersions(packageName);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Sidebar closeButton={false} intent="inset">
|
||||
<SidebarHeader className="bg-[#f3f3f4] p-4 dark:bg-[#121214]">
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex place-content-between place-items-center p-1">
|
||||
<Link className="text-xl font-bold" href={`/docs/packages/${packageName}/${version}`}>
|
||||
{packageName}
|
||||
</Link>
|
||||
<div className="flex place-items-center gap-2">
|
||||
<Link
|
||||
aria-label="GitHub"
|
||||
className={buttonStyles({ variant: 'filled', size: 'icon-sm' })}
|
||||
href="https://github.com/discordjs/discord.js"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<VscGithubInverted aria-hidden data-slot="icon" size={18} />
|
||||
</Link>
|
||||
<ThemeSwitchNoSRR />
|
||||
</div>
|
||||
</div>
|
||||
<PackageSelect />
|
||||
{/* <h3 className="p-1 text-lg font-semibold">{version}</h3> */}
|
||||
<VersionSelect versionsPromise={versions} />
|
||||
<SearchButton />
|
||||
</div>
|
||||
</SidebarHeader>
|
||||
<SidebarContent className="bg-[#f3f3f4] p-0 py-4 pl-4 dark:bg-[#121214]">
|
||||
<Scrollbars>
|
||||
<Navigation packageName={packageName} version={version} />
|
||||
</Scrollbars>
|
||||
</SidebarContent>
|
||||
</Sidebar>
|
||||
<SidebarInset>
|
||||
{ENV.IS_LOCAL_DEV ? (
|
||||
<div className="sticky top-0 z-10 flex place-content-center place-items-center border border-red-400/35 bg-red-500/65 p-2 px-4 text-center text-base text-white shadow-md backdrop-blur">
|
||||
Local test environment
|
||||
</div>
|
||||
) : null}
|
||||
{ENV.IS_PREVIEW ? (
|
||||
<div className="sticky top-0 z-10 flex place-content-center place-items-center border border-red-400/35 bg-red-500/65 p-2 px-4 text-center text-base text-white shadow-md backdrop-blur">
|
||||
Preview environment
|
||||
</div>
|
||||
) : null}
|
||||
<div className="bg-[#fbfbfb] pb-12 dark:bg-[#1a1a1e]">
|
||||
<div className="relative px-6 pt-6 md:hidden">
|
||||
<div className="fixed top-5 left-6 z-20 md:hidden">
|
||||
<SidebarTrigger aria-label="Navigation" size="icon" variant="filled" />
|
||||
</div>
|
||||
<div className="flex place-content-end">
|
||||
<Link className="text-xl font-bold" href={`/docs/packages/${packageName}/${version}`}>
|
||||
{packageName}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
{children}
|
||||
<Footer />
|
||||
</div>
|
||||
</SidebarInset>
|
||||
<Suspense>
|
||||
<CmdK params={params} />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
'use cache';
|
||||
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import rehypeShikiFromHighlighter from '@shikijs/rehype/core';
|
||||
import { MDXRemote } from 'next-mdx-remote-client/rsc';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import { getSingletonHighlighter } from '@/util/shiki.bundle';
|
||||
|
||||
export default async function Page({ params }: { readonly params: Promise<{ readonly packageName: string }> }) {
|
||||
const { packageName } = await params;
|
||||
|
||||
const fileContent = await readFile(join(process.cwd(), `src/assets/readme/${packageName}/home-README.md`), 'utf8');
|
||||
|
||||
return (
|
||||
<div className="prose prose-neutral dark:prose-invert prose-a:[&>img]:inline-block prose-a:[&>img]:m-0 prose-a:[&>img[height='44']]:h-11 prose-p:my-2 prose-pre:py-3 prose-pre:rounded-sm prose-pre:px-0 prose-pre:border prose-pre:border-[#d4d4d4] dark:prose-pre:border-[#404040] prose-code:font-normal prose-a:text-[#5865F2] prose-a:no-underline prose-a:hover:text-[#3d48c3] dark:prose-a:hover:text-[#7782fa] mx-auto max-w-screen-xl px-6 py-6 [&_code_span:last-of-type:empty]:hidden [&_div[align='center']_p_a+a]:ml-2">
|
||||
<MDXRemote
|
||||
options={{
|
||||
mdxOptions: {
|
||||
remarkPlugins: [remarkGfm],
|
||||
rehypePlugins: [
|
||||
[
|
||||
rehypeShikiFromHighlighter,
|
||||
await getSingletonHighlighter({
|
||||
langs: ['typescript', 'javascript', 'shellscript'],
|
||||
themes: ['github-light', 'github-dark-dimmed'],
|
||||
}),
|
||||
{
|
||||
themes: {
|
||||
light: 'github-light',
|
||||
dark: 'github-dark-dimmed',
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
}}
|
||||
source={fileContent}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
import { Analytics } from '@vercel/analytics/react';
|
||||
import { GeistMono } from 'geist/font/mono';
|
||||
import { GeistSans } from 'geist/font/sans';
|
||||
import type { Metadata, Viewport } from 'next';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { DESCRIPTION } from '@/util/constants';
|
||||
import { ENV } from '@/util/env';
|
||||
import { Providers } from './providers';
|
||||
|
||||
import '@/styles/base.css';
|
||||
import 'overlayscrollbars/overlayscrollbars.css';
|
||||
|
||||
export const viewport: Viewport = {
|
||||
themeColor: [
|
||||
{ media: '(prefers-color-scheme: light)', color: '#fbfbfb' },
|
||||
{ media: '(prefers-color-scheme: dark)', color: '#1a1a1e' },
|
||||
],
|
||||
colorScheme: 'light dark',
|
||||
};
|
||||
|
||||
export const metadata: Metadata = {
|
||||
metadataBase: new URL(ENV.IS_LOCAL_DEV ? `http://localhost:${ENV.PORT}` : 'https://discord.js.org'),
|
||||
title: {
|
||||
template: '%s | discord.js',
|
||||
default: 'discord.js',
|
||||
},
|
||||
description: DESCRIPTION,
|
||||
icons: {
|
||||
other: [
|
||||
{
|
||||
url: '/favicon-32x32.png',
|
||||
sizes: '32x32',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
url: '/favicon-16x16.png',
|
||||
sizes: '16x16',
|
||||
type: 'image/png',
|
||||
},
|
||||
],
|
||||
apple: [
|
||||
'/apple-touch-icon.png',
|
||||
{
|
||||
url: '/safari-pinned-tab.svg',
|
||||
rel: 'mask-icon',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
manifest: '/site.webmanifest',
|
||||
|
||||
appleWebApp: {
|
||||
title: 'discord.js',
|
||||
},
|
||||
|
||||
applicationName: 'discord.js',
|
||||
|
||||
openGraph: {
|
||||
siteName: 'discord.js',
|
||||
type: 'website',
|
||||
title: 'discord.js',
|
||||
description: DESCRIPTION,
|
||||
images: 'https://discordjs.dev/api/open-graph.png',
|
||||
},
|
||||
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
creator: '@iCrawlToGo',
|
||||
},
|
||||
|
||||
other: {
|
||||
'msapplication-TileColor': '#1a1a1e',
|
||||
},
|
||||
};
|
||||
|
||||
export default async function RootLayout({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<html className={`${GeistSans.variable} ${GeistMono.variable} antialiased`} lang="en" suppressHydrationWarning>
|
||||
<body className="text-base-md text-base-neutral-900 dark:text-base-neutral-40 overscroll-y-none bg-[#fbfbfb] dark:bg-[#1a1a1e]">
|
||||
<Providers>{children}</Providers>
|
||||
<Analytics />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<div className="mx-auto flex min-h-[calc(100vh_-_100px)] max-w-lg flex-col place-content-center place-items-center gap-8 px-8 py-16 lg:px-6 lg:py-0">
|
||||
<h1 className="text-[9rem] leading-none font-black md:text-[12rem]">404</h1>
|
||||
<h2 className="text-[2rem] md:text-[3rem]">Not found.</h2>
|
||||
<Link
|
||||
className="bg-base-blurple-400 inline-flex rounded-md border border-transparent px-6 py-2 font-medium text-white"
|
||||
href="/docs"
|
||||
>
|
||||
Take me back
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/* eslint-disable react/no-unknown-property */
|
||||
|
||||
import { ImageResponse } from 'next/og';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
export const size = {
|
||||
width: 1_200,
|
||||
height: 630,
|
||||
};
|
||||
|
||||
export const contentType = 'image/png';
|
||||
|
||||
export default async function Image() {
|
||||
const fontData = await fetch(new URL('../assets/Geist-Black.ttf', import.meta.url), {
|
||||
next: { revalidate: 604_800 },
|
||||
}).then(async (res) => res.arrayBuffer());
|
||||
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div tw="flex bg-[#121214] h-full w-full">
|
||||
<div tw="mx-auto flex items-center h-full">
|
||||
<div tw="flex">
|
||||
<div tw="flex">
|
||||
<div tw="flex flex-col font-black text-8xl text-white leading-tight">
|
||||
<div tw="flex flex-row">
|
||||
The <span tw="bg-[#5865f2] rounded-md px-3 py-2 ml-4 bottom-2">most popular</span>
|
||||
</div>
|
||||
<span>way to build Discord</span>
|
||||
<span>bots.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
{
|
||||
...size,
|
||||
fonts: [
|
||||
{
|
||||
name: 'Geist',
|
||||
data: fontData,
|
||||
weight: 900,
|
||||
style: 'normal',
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
import { ExternalLink } from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
import vercelLogo from '@/assets/powered-by-vercel.svg';
|
||||
import workersLogo from '@/assets/powered-by-workers.png';
|
||||
import { InstallButton } from '@/components/InstallButton';
|
||||
import { buttonStyles } from '@/styles/ui/button';
|
||||
import { DESCRIPTION } from '@/util/constants';
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<div className="mx-auto flex min-h-screen w-full max-w-screen-lg flex-col place-content-center place-items-center gap-24 px-8 pt-12 pb-16">
|
||||
<div className="flex flex-col gap-10 text-center">
|
||||
<h1 className="text-base-heading-xl font-black sm:text-7xl sm:leading-tight">
|
||||
The{' '}
|
||||
<span className="bg-base-blurple-400 text-base-neutral-0 relative rounded-sm px-3 py-2">most popular</span>{' '}
|
||||
way to build Discord bots.
|
||||
</h1>
|
||||
<p className="text-base-neutral-600 dark:text-base-neutral-300 md:my-6">{DESCRIPTION}</p>
|
||||
|
||||
<div className="flex flex-wrap place-content-center gap-4 sm:flex-wrap md:flex-row">
|
||||
<Link className={buttonStyles({ variant: 'filled' })} href="/docs">
|
||||
Docs
|
||||
</Link>
|
||||
<a
|
||||
className={buttonStyles({ variant: 'discreet' })}
|
||||
href="https://discordjs.guide"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
Guide <ExternalLink aria-hidden data-slot="icon" size={18} />
|
||||
</a>
|
||||
<a
|
||||
className={buttonStyles({ variant: 'discreet' })}
|
||||
href="https://github.com/discordjs/discord.js"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
GitHub <ExternalLink aria-hidden data-slot="icon" size={18} />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<InstallButton className="place-self-center" />
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-4 md:flex-row">
|
||||
<a
|
||||
href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
title="Vercel"
|
||||
>
|
||||
<Image
|
||||
alt="Vercel"
|
||||
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABLCAQAAAA1k5H2AAAAi0lEQVR42u3SMQEAAAgDoC251a3gL2SgmfBYBRAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAgwWEOSWBnYbKggAAAABJRU5ErkJggg=="
|
||||
height={44}
|
||||
placeholder="blur"
|
||||
priority
|
||||
src={vercelLogo}
|
||||
width={212}
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
href="https://www.cloudflare.com"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
title="Cloudflare Workers"
|
||||
>
|
||||
<Image
|
||||
alt="Cloudflare"
|
||||
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABLCAQAAAA1k5H2AAAAi0lEQVR42u3SMQEAAAgDoC251a3gL2SgmfBYBRAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAgwWEOSWBnYbKggAAAABJRU5ErkJggg=="
|
||||
height={44}
|
||||
placeholder="blur"
|
||||
priority
|
||||
src={workersLogo}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { Provider as JotaiProvider } from 'jotai';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { ThemeProvider } from 'next-themes';
|
||||
import { NuqsAdapter } from 'nuqs/adapters/next/app';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { RouterProvider } from 'react-aria-components';
|
||||
import { SidebarProvider } from '@/components/ui/Sidebar';
|
||||
import { useSystemThemeFallback } from '@/hooks/useSystemThemeFallback';
|
||||
import { useUnregisterServiceWorker } from '@/hooks/useUnregisterServiceWorker';
|
||||
|
||||
export function Providers({ children }: PropsWithChildren) {
|
||||
const router = useRouter();
|
||||
useUnregisterServiceWorker();
|
||||
useSystemThemeFallback();
|
||||
|
||||
return (
|
||||
<NuqsAdapter>
|
||||
<ThemeProvider attribute="class">
|
||||
<RouterProvider navigate={router.push}>
|
||||
<JotaiProvider>
|
||||
<SidebarProvider defaultOpen>{children}</SidebarProvider>
|
||||
</JotaiProvider>
|
||||
</RouterProvider>
|
||||
</ThemeProvider>
|
||||
</NuqsAdapter>
|
||||
);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="212" height="44" fill="none"><rect width="212" height="44" fill="#000" rx="8"/><path fill="#fff" d="M60.438 15.227V26.5h1.406v-4.023h2.836c2.117 0 3.625-1.493 3.625-3.602 0-2.148-1.477-3.648-3.61-3.648h-4.257Zm1.406 1.25h2.484c1.633 0 2.531.851 2.531 2.398 0 1.492-.93 2.352-2.53 2.352h-2.485v-4.75Zm11.5 10.171c2.399 0 3.883-1.656 3.883-4.359 0-2.71-1.484-4.36-3.883-4.36-2.398 0-3.883 1.65-3.883 4.36 0 2.703 1.485 4.36 3.883 4.36Zm0-1.21c-1.594 0-2.492-1.157-2.492-3.149 0-2 .898-3.148 2.492-3.148 1.594 0 2.492 1.148 2.492 3.148 0 1.992-.898 3.148-2.492 3.148Zm15.954-7.36h-1.352l-1.656 6.735h-.125l-1.883-6.735h-1.29l-1.882 6.735h-.125l-1.656-6.735h-1.36l2.36 8.422h1.36l1.874-6.516h.125l1.883 6.516h1.367l2.36-8.422Zm4.523 1.04c1.336 0 2.227.984 2.258 2.476h-4.64c.101-1.492 1.039-2.477 2.382-2.477Zm2.219 5.202c-.352.742-1.086 1.14-2.172 1.14-1.43 0-2.36-1.054-2.43-2.718v-.062h6.055v-.516c0-2.617-1.383-4.234-3.656-4.234-2.313 0-3.797 1.718-3.797 4.367 0 2.664 1.46 4.351 3.797 4.351 1.844 0 3.156-.89 3.547-2.328H96.04Zm3.242 2.18h1.344v-5.219c0-1.187.93-2.047 2.211-2.047.266 0 .75.047.86.078V17.97a5.77 5.77 0 0 0-.672-.04c-1.117 0-2.086.579-2.336 1.4h-.125v-1.25h-1.281V26.5Zm8.899-7.383c1.336 0 2.227.985 2.258 2.477h-4.641c.102-1.492 1.04-2.477 2.383-2.477Zm2.219 5.203c-.352.742-1.086 1.14-2.172 1.14-1.43 0-2.359-1.054-2.43-2.718v-.062h6.055v-.516c0-2.617-1.383-4.234-3.656-4.234-2.313 0-3.797 1.718-3.797 4.367 0 2.664 1.461 4.351 3.797 4.351 1.844 0 3.156-.89 3.547-2.328H110.4Zm6.36 2.328c1.164 0 2.164-.554 2.695-1.492h.125V26.5h1.281V14.734h-1.343v4.672h-.118c-.476-.922-1.468-1.476-2.64-1.476-2.141 0-3.539 1.718-3.539 4.36 0 2.648 1.382 4.358 3.539 4.358Zm.312-7.507c1.524 0 2.477 1.218 2.477 3.148 0 1.945-.946 3.148-2.477 3.148-1.539 0-2.461-1.18-2.461-3.148 0-1.96.93-3.148 2.461-3.148Zm14.462 7.507c2.133 0 3.531-1.726 3.531-4.359 0-2.648-1.391-4.36-3.531-4.36-1.156 0-2.18.571-2.641 1.477h-.125v-4.672h-1.344V26.5h1.282v-1.344h.125c.531.938 1.531 1.492 2.703 1.492Zm-.313-7.507c1.539 0 2.453 1.18 2.453 3.148 0 1.969-.914 3.148-2.453 3.148-1.531 0-2.484-1.203-2.484-3.148s.953-3.148 2.484-3.148Zm6.04 10.406c1.492 0 2.164-.578 2.882-2.531l3.29-8.938h-1.43l-2.305 6.93h-.125l-2.312-6.93h-1.453l3.117 8.43-.157.5c-.351 1.015-.773 1.383-1.546 1.383-.188 0-.399-.008-.563-.04V29.5c.188.031.422.047.602.047Zm17.391-3.047 3.898-11.273h-2.148l-2.813 8.921h-.132l-2.836-8.921h-2.227l3.938 11.273h2.32Zm8.016-7.18c1.164 0 1.93.813 1.969 2.078h-4.024c.086-1.25.899-2.078 2.055-2.078Zm1.984 4.828c-.281.633-.945.985-1.906.985-1.273 0-2.094-.89-2.141-2.313v-.101h5.969v-.625c0-2.696-1.461-4.313-3.898-4.313-2.477 0-4.016 1.727-4.016 4.477s1.516 4.414 4.031 4.414c2.016 0 3.446-.969 3.797-2.524h-1.836Zm3.547 2.352h1.938v-4.938c0-1.195.875-1.976 2.133-1.976.328 0 .843.055.992.11v-1.798c-.18-.054-.524-.085-.805-.085-1.101 0-2.023.625-2.258 1.468h-.132v-1.328h-1.868V26.5Zm13.501-5.672c-.203-1.797-1.532-3.047-3.727-3.047-2.57 0-4.078 1.649-4.078 4.422 0 2.813 1.516 4.469 4.086 4.469 2.164 0 3.508-1.203 3.719-2.992h-1.844c-.203.89-.875 1.367-1.883 1.367-1.32 0-2.117-1.047-2.117-2.844 0-1.773.789-2.797 2.117-2.797 1.063 0 1.703.594 1.883 1.422h1.844Zm5.117-1.508c1.164 0 1.93.813 1.969 2.078h-4.024c.086-1.25.899-2.078 2.055-2.078Zm1.985 4.828c-.282.633-.946.985-1.907.985-1.273 0-2.093-.89-2.14-2.313v-.101h5.968v-.625c0-2.696-1.461-4.313-3.898-4.313-2.477 0-4.016 1.727-4.016 4.477s1.516 4.414 4.032 4.414c2.015 0 3.445-.969 3.796-2.524h-1.835Zm3.625 2.352h1.937V14.648h-1.937V26.5ZM23.325 13l9.325 16H14l9.325-16Z"/><path stroke="#5E5E5E" d="M43.5 0v44"/></svg>
|
||||
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,41 +0,0 @@
|
||||
import { AlertTriangle } from 'lucide-react';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
|
||||
export function Badge({ children, className = '' }: PropsWithChildren<{ readonly className?: string }>) {
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex place-items-center gap-1 rounded-full px-2 py-1 font-sans text-sm leading-none font-normal ${className}`}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export async function Badges({ node }: { readonly node: any }) {
|
||||
const isDeprecated = Boolean(node.summary?.deprecatedBlock?.length);
|
||||
const isProtected = node.isProtected;
|
||||
const isStatic = node.isStatic;
|
||||
const isAbstract = node.isAbstract;
|
||||
const isReadonly = node.isReadonly;
|
||||
const isOptional = node.isOptional;
|
||||
const isExternal = node.isExternal;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
const isAny = isDeprecated || isProtected || isStatic || isAbstract || isReadonly || isOptional || isExternal;
|
||||
|
||||
return isAny ? (
|
||||
<div className="mb-1 flex gap-3">
|
||||
{isDeprecated ? (
|
||||
<Badge className="bg-red-500/20 text-red-500">
|
||||
<AlertTriangle aria-hidden size={14} /> deprecated
|
||||
</Badge>
|
||||
) : null}
|
||||
{isProtected ? <Badge className="bg-purple-500/20 text-purple-500">protected</Badge> : null}
|
||||
{isStatic ? <Badge className="bg-purple-500/20 text-purple-500">static</Badge> : null}
|
||||
{isAbstract ? <Badge className="bg-cyan-500/20 text-cyan-500">abstract</Badge> : null}
|
||||
{isReadonly ? <Badge className="bg-purple-500/20 text-purple-500">readonly</Badge> : null}
|
||||
{isOptional ? <Badge className="bg-cyan-500/20 text-cyan-500">optional</Badge> : null}
|
||||
{isExternal ? <Badge className="bg-purple-500/20 text-purple-500">external</Badge> : null}
|
||||
</div>
|
||||
) : null;
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { Command } from 'cmdk';
|
||||
import { useAtom, useSetAtom } from 'jotai';
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
import MeiliSearch from 'meilisearch';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useDebounceValue, useMediaQuery } from 'usehooks-ts';
|
||||
import { Scrollbars } from '@/components/OverlayScrollbars';
|
||||
import { isCmdKOpenAtom } from '@/stores/cmdk';
|
||||
import { isDrawerOpenAtom } from '@/stores/drawer';
|
||||
import { cx } from '@/styles/cva';
|
||||
import { resolveKind } from '@/util/resolveNodeKind';
|
||||
|
||||
const client = new MeiliSearch({
|
||||
host: 'https://search.discordjs.dev',
|
||||
apiKey: 'b51923c6abb574b1e97be9a03dc6414b6c69fb0c5696d0ef01a82b0f77d223db',
|
||||
});
|
||||
|
||||
export function CmdK({ dependencies }: { readonly dependencies: string[] }) {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const [open, setOpen] = useAtom(isCmdKOpenAtom);
|
||||
const setDrawerOpen = useSetAtom(isDrawerOpenAtom);
|
||||
const [search, setSearch] = useDebounceValue('', 250);
|
||||
const [searchResults, setSearchResults] = useState<any[]>([]);
|
||||
const isMobile = useMediaQuery('(max-width: 600px)');
|
||||
|
||||
const packageName = pathname?.split('/').slice(3, 4)[0];
|
||||
const branchName = pathname?.split('/').slice(4, 5)[0];
|
||||
|
||||
const searchResultItems =
|
||||
searchResults?.map((item, idx) => (
|
||||
<Command.Item
|
||||
className="flex cursor-pointer place-items-center gap-2 rounded-md p-2 data-[selected='true']:bg-neutral-200 dark:data-[selected='true']:bg-neutral-800"
|
||||
key={`${item.id}-${idx}`}
|
||||
onSelect={() => {
|
||||
router.push(item.path);
|
||||
setOpen(false);
|
||||
}}
|
||||
value={item.id}
|
||||
>
|
||||
{resolveKind(item.kind)}
|
||||
<div className="flex flex-grow flex-col">
|
||||
<span className="font-semibold wrap-anywhere">{item.name}</span>
|
||||
<span className={cx('truncate text-sm', isMobile ? 'max-w-[30ch]' : 'max-w-[40ch]')}>{item.summary}</span>
|
||||
<span className={cx('truncate text-xs', isMobile ? 'max-w-[30ch]' : 'max-w-[40ch]')}>{item.path}</span>
|
||||
</div>
|
||||
<ArrowRight aria-hidden className="flex-shrink-0" />
|
||||
</Command.Item>
|
||||
)) ?? [];
|
||||
|
||||
// Toggle the menu when ⌘K is pressed
|
||||
useEffect(() => {
|
||||
const down = (event: KeyboardEvent) => {
|
||||
if (event.key === 'k' && (event.metaKey || event.ctrlKey)) {
|
||||
event.preventDefault();
|
||||
setOpen((open) => !open);
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('keydown', down);
|
||||
return () => {
|
||||
document.removeEventListener('keydown', down);
|
||||
};
|
||||
}, [setOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setDrawerOpen(false);
|
||||
setSearch('');
|
||||
}
|
||||
|
||||
return () => {
|
||||
document.body.style.pointerEvents = 'auto';
|
||||
};
|
||||
}, [open, setDrawerOpen, setSearch]);
|
||||
|
||||
useEffect(() => {
|
||||
// const searchDoc = async (searchString: string, version: string) => {
|
||||
// console.log(dependencies);
|
||||
// const res = await client
|
||||
// .index(`${packageName?.replaceAll('.', '-')}-${version}`)
|
||||
// .search(searchString, { limit: 25 });
|
||||
// setSearchResults(res.hits);
|
||||
// };
|
||||
|
||||
const searchDoc = async (searchString: string, version: string) => {
|
||||
const result = await client.multiSearch({
|
||||
queries: [`${packageName?.replaceAll('.', '-')}-${version}`, ...dependencies].map((dep) => ({
|
||||
indexUid: dep,
|
||||
// eslint-disable-next-line id-length
|
||||
q: searchString,
|
||||
limit: 25,
|
||||
attributesToSearchOn: ['name'],
|
||||
sort: ['type:asc'],
|
||||
})),
|
||||
});
|
||||
setSearchResults(result.results.flatMap((res) => res.hits));
|
||||
};
|
||||
|
||||
if (search && packageName) {
|
||||
void searchDoc(search, branchName?.replaceAll('.', '-') ?? 'main');
|
||||
} else {
|
||||
setSearchResults([]);
|
||||
}
|
||||
}, [branchName, dependencies, packageName, search]);
|
||||
|
||||
return (
|
||||
<Command.Dialog
|
||||
className="w-full rounded-md border border-neutral-300 bg-neutral-100 p-2 shadow-md dark:border-neutral-700 dark:bg-neutral-900"
|
||||
label="Command Menu"
|
||||
onOpenChange={setOpen}
|
||||
open={open}
|
||||
shouldFilter={false}
|
||||
>
|
||||
<Command.Input
|
||||
className="mb-4 w-full border-b border-neutral-300 bg-transparent px-2 pt-2 pb-4 outline-none dark:border-neutral-700"
|
||||
onValueChange={setSearch}
|
||||
placeholder="Quick search..."
|
||||
/>
|
||||
<Scrollbars
|
||||
className="max-h-96 pr-3"
|
||||
defer
|
||||
options={{
|
||||
overflow: { x: 'hidden' },
|
||||
scrollbars: {
|
||||
autoHide: 'scroll',
|
||||
autoHideDelay: 500,
|
||||
autoHideSuspend: true,
|
||||
clickScroll: true,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Command.List>
|
||||
{search && searchResultItems.length ? (
|
||||
searchResultItems
|
||||
) : (
|
||||
<div className="flex h-12 place-content-center place-items-center text-sm" role="presentation">
|
||||
No results found.
|
||||
</div>
|
||||
)}
|
||||
</Command.List>
|
||||
</Scrollbars>
|
||||
</Command.Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export const CmdKNoSRR = dynamic(async () => CmdK, { ssr: false });
|
||||
@@ -1,52 +0,0 @@
|
||||
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
|
||||
import { Code2, LinkIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { ENV } from '@/util/env';
|
||||
import { ParameterNode } from './ParameterNode';
|
||||
import { SummaryNode } from './SummaryNode';
|
||||
|
||||
export async function ConstructorNode({ node, version }: { readonly node: any; readonly version: string }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<h2 className="flex place-items-center gap-2 p-2 text-xl font-bold">
|
||||
<VscSymbolMethod aria-hidden className="flex-shrink-0" size={24} />
|
||||
Constructors
|
||||
</h2>
|
||||
|
||||
<div className="flex place-content-between place-items-center gap-1">
|
||||
<h3
|
||||
className={`${ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group px-2 font-mono font-semibold break-all`}
|
||||
id="constructor"
|
||||
>
|
||||
{/* constructor({parsedContent.constructor.parametersString}) */}
|
||||
<Link className="float-left -ml-6 hidden pr-2 pb-2 group-hover:block" href="#constructor">
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
constructor({node.parameters?.length ? <ParameterNode node={node.parameters} version={version} /> : null})
|
||||
</h3>
|
||||
|
||||
<a
|
||||
aria-label="Open source file in new tab"
|
||||
className="min-w-min"
|
||||
href={node.sourceLine ? `${node.sourceURL}#L${node.sourceLine}` : node.sourceURL}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
<Code2
|
||||
aria-hidden
|
||||
className="text-neutral-500 hover:text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300"
|
||||
size={20}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{node.summary?.summarySection.length ? (
|
||||
<SummaryNode node={node.summary.summarySection} padding version={version} />
|
||||
) : null}
|
||||
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { DocNode } from './DocNode';
|
||||
import { Alert } from './ui/Alert';
|
||||
|
||||
export async function DeprecatedNode({
|
||||
deprecatedBlock,
|
||||
version,
|
||||
}: {
|
||||
readonly deprecatedBlock: any;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<Alert title="Deprecated" type="danger">
|
||||
<p className="break-words">
|
||||
<DocNode node={deprecatedBlock} version={version} />
|
||||
</p>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
import { VscSymbolParameter } from '@react-icons/all-files/vsc/VscSymbolParameter';
|
||||
import { ConstructorNode } from './ConstructorNode';
|
||||
import { DeprecatedNode } from './DeprecatedNode';
|
||||
import { EnumMemberNode } from './EnumMemberNode';
|
||||
import { EventNode } from './EventNode';
|
||||
import { InformationNode } from './InformationNode';
|
||||
import { MethodNode } from './MethodNode';
|
||||
import { Outline } from './Outline';
|
||||
import { Scrollbars } from './OverlayScrollbars';
|
||||
import { ParameterNode } from './ParameterNode';
|
||||
import { PropertyNode } from './PropertyNode';
|
||||
import { ReturnNode } from './ReturnNode';
|
||||
import { SeeNode } from './SeeNode';
|
||||
import { SummaryNode } from './SummaryNode';
|
||||
import { SyntaxHighlighter } from './SyntaxHighlighter';
|
||||
import { TypeParameterNode } from './TypeParameterNode';
|
||||
import { UnionMember } from './UnionMember';
|
||||
import { Tab, TabList, TabPanel, Tabs } from './ui/Tabs';
|
||||
|
||||
async function OverloadNode({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
'use cache';
|
||||
|
||||
return (
|
||||
<Tabs className="flex flex-col gap-4">
|
||||
<TabList className="flex gap-2">
|
||||
{node.overloads.map((overload: any) => (
|
||||
<Tab
|
||||
className="cursor-pointer rounded-full bg-neutral-800/10 px-2 py-1 font-sans text-sm leading-none font-normal text-neutral-800 hover:bg-neutral-800/20 data-[selected]:bg-neutral-500 data-[selected]:text-neutral-100 dark:bg-neutral-200/10 dark:text-neutral-200 dark:hover:bg-neutral-200/20 dark:data-[selected]:bg-neutral-500/70"
|
||||
id={`overload-${overload.displayName}-${overload.overloadIndex}`}
|
||||
key={`overload-tab-${overload.displayName}-${overload.overloadIndex}`}
|
||||
>
|
||||
<span>Overload {overload.overloadIndex}</span>
|
||||
</Tab>
|
||||
))}
|
||||
</TabList>
|
||||
{node.overloads.map((overload: any) => (
|
||||
<TabPanel
|
||||
className="flex flex-col gap-4"
|
||||
id={`overload-${overload.displayName}-${overload.overloadIndex}`}
|
||||
key={`overload-tab-panel-${overload.displayName}-${overload.overloadIndex}`}
|
||||
>
|
||||
<DocItem node={overload} packageName={packageName} version={version} />
|
||||
</TabPanel>
|
||||
))}
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
export async function DocItem({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
'use cache';
|
||||
|
||||
if (node.overloads?.length) {
|
||||
return <OverloadNode node={node} packageName={packageName} version={version} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<InformationNode node={node} version={version} />
|
||||
|
||||
<Scrollbars className="border-base-neutral-200 dark:border-base-neutral-600 bg-base-neutral-100 dark:bg-base-neutral-900 rounded-sm border">
|
||||
<SyntaxHighlighter
|
||||
className="bg-[#f3f3f4] py-4 text-sm dark:bg-[#121214]"
|
||||
code={node.sourceExcerpt}
|
||||
lang="typescript"
|
||||
/>
|
||||
</Scrollbars>
|
||||
|
||||
{node.summary?.deprecatedBlock.length ? (
|
||||
<DeprecatedNode deprecatedBlock={node.summary.deprecatedBlock} version={version} />
|
||||
) : null}
|
||||
|
||||
{node.summary?.summarySection ? <SummaryNode node={node.summary.summarySection} version={version} /> : null}
|
||||
|
||||
{node.summary?.returnsBlock.length ? <ReturnNode node={node.summary.returnsBlock} version={version} /> : null}
|
||||
|
||||
{node.summary?.seeBlocks.length ? <SeeNode node={node.summary.seeBlocks} version={version} /> : null}
|
||||
|
||||
<Outline node={node} />
|
||||
|
||||
{node.constructor?.parametersString ? <ConstructorNode node={node.constructor} version={version} /> : null}
|
||||
|
||||
{node.typeParameters?.length ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<h2 className="flex place-items-center gap-2 p-2 text-xl font-bold">
|
||||
<VscSymbolParameter aria-hidden className="flex-shrink-0" size={24} />
|
||||
Type Parameters
|
||||
</h2>
|
||||
<TypeParameterNode description node={node.typeParameters} version={version} />
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{node.parameters?.length ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<h2 className="flex place-items-center gap-2 p-2 text-xl font-bold">
|
||||
<VscSymbolParameter aria-hidden className="flex-shrink-0" size={24} />
|
||||
Parameters
|
||||
</h2>
|
||||
<ParameterNode description node={node.parameters} version={version} />
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{node.members?.properties?.length ? (
|
||||
<PropertyNode node={node.members.properties} packageName={packageName} version={version} />
|
||||
) : null}
|
||||
|
||||
{node.members?.methods?.length ? (
|
||||
<div>
|
||||
<MethodNode node={node.members.methods} packageName={packageName} version={version} />
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{node.members?.events?.length ? (
|
||||
<div>
|
||||
<EventNode node={node.members.events} packageName={packageName} version={version} />
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{node.members?.length ? <EnumMemberNode node={node.members} packageName={packageName} version={version} /> : null}
|
||||
|
||||
{node.unionMembers?.length ? <UnionMember node={node.unionMembers} version={version} /> : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
export function resolveNodeKind(kind: string) {
|
||||
switch (kind) {
|
||||
case 'Class':
|
||||
return {
|
||||
text: 'text-green-500',
|
||||
background: 'bg-green-500/20',
|
||||
};
|
||||
case 'Interface':
|
||||
return {
|
||||
text: 'text-amber-500',
|
||||
background: 'bg-amber-500/20',
|
||||
};
|
||||
case 'Function':
|
||||
return {
|
||||
text: 'text-blue-500',
|
||||
background: 'bg-blue-500/20',
|
||||
};
|
||||
case 'Enum':
|
||||
return {
|
||||
text: 'text-rose-500',
|
||||
background: 'bg-rose-500/20',
|
||||
};
|
||||
case 'TypeAlias':
|
||||
return {
|
||||
text: 'text-pink-500',
|
||||
background: 'bg-pink-500/20',
|
||||
};
|
||||
case 'Variable':
|
||||
return {
|
||||
text: 'text-purple-500',
|
||||
background: 'bg-purple-500/20',
|
||||
};
|
||||
default:
|
||||
return {
|
||||
text: 'text-gray-500',
|
||||
background: 'bg-gray-500/20',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function DocKind({ background = false, node }: { readonly background?: boolean; readonly node: any }) {
|
||||
const kind = resolveNodeKind(node.kind);
|
||||
return <span className={background ? `${kind.background} ${kind.text}` : kind.text}>{node.kind.toLowerCase()}</span>;
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
import { BuiltinDocumentationLinks } from '@/util/builtinDocumentationLinks';
|
||||
import { Scrollbars } from './OverlayScrollbars';
|
||||
import { SyntaxHighlighter } from './SyntaxHighlighter';
|
||||
|
||||
export async function DocNode({ node, version }: { readonly node?: any; readonly version: string }) {
|
||||
const createNode = (node: any, idx: number) => {
|
||||
switch (node.kind) {
|
||||
case 'PlainText':
|
||||
return <span key={`${node.text}-${idx}`}>{node.text}</span>;
|
||||
case 'LinkTag': {
|
||||
if (node.resolvedPackage) {
|
||||
return (
|
||||
<Link
|
||||
className="text-base-blurple-400 hover:text-base-blurple-500 dark:hover:text-base-blurple-300 font-mono"
|
||||
href={`/docs/packages/${node.resolvedPackage.packageName}/${node.resolvedPackage.version ?? version}/${node.uri}`}
|
||||
key={`${node.uri}-${idx}`}
|
||||
// @ts-expect-error - unstable_dynamicOnHover is not part of the public types
|
||||
unstable_dynamicOnHover
|
||||
>
|
||||
{node.text}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
if (node.uri) {
|
||||
return (
|
||||
<a
|
||||
className="text-base-blurple-400 hover:text-base-blurple-500 dark:hover:text-base-blurple-300"
|
||||
href={node.uri}
|
||||
key={`${node.text}-${idx}`}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{`${node.text}${node.members ?? ''}`}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
if (node.text in BuiltinDocumentationLinks) {
|
||||
const href = BuiltinDocumentationLinks[node.text as keyof typeof BuiltinDocumentationLinks];
|
||||
return (
|
||||
<a
|
||||
className="text-base-blurple-400 hover:text-base-blurple-500 dark:hover:text-base-blurple-300"
|
||||
href={href}
|
||||
key={`${node.text}-${idx}`}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{node.text}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
return <span key={`${node.text}-${idx}`}>{node.text}</span>;
|
||||
}
|
||||
|
||||
case 'CodeSpan':
|
||||
return (
|
||||
<code className="font-mono text-sm" key={`${node.text}-${idx}`}>
|
||||
{node.text}
|
||||
</code>
|
||||
);
|
||||
|
||||
case 'FencedCode': {
|
||||
const { language, text } = node;
|
||||
|
||||
return (
|
||||
<Scrollbars
|
||||
className="border-base-neutral-200 dark:border-base-neutral-600 bg-base-neutral-100 dark:bg-base-neutral-900 my-4 rounded-sm border"
|
||||
defer
|
||||
key={`${language}-${text}-${idx}`}
|
||||
>
|
||||
<SyntaxHighlighter className="bg-[#f3f3f4] py-4 text-sm dark:bg-[#121214]" code={text} lang={language} />
|
||||
</Scrollbars>
|
||||
);
|
||||
}
|
||||
|
||||
case 'SoftBreak':
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return node?.map(createNode) ?? null;
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
import { VscSymbolEnumMember } from '@react-icons/all-files/vsc/VscSymbolEnumMember';
|
||||
import { Code2, LinkIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { Fragment } from 'react';
|
||||
import { ENV } from '@/util/env';
|
||||
import { Badges } from './Badges';
|
||||
import { DeprecatedNode } from './DeprecatedNode';
|
||||
import { ExampleNode } from './ExampleNode';
|
||||
import { ExcerptNode } from './ExcerptNode';
|
||||
import { InheritedFromNode } from './InheritedFromNode';
|
||||
import { ParameterNode } from './ParameterNode';
|
||||
import { ReturnNode } from './ReturnNode';
|
||||
import { SeeNode } from './SeeNode';
|
||||
import { SummaryNode } from './SummaryNode';
|
||||
|
||||
export async function EnumMemberNode({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<h2 className="flex place-items-center gap-2 p-2 text-xl font-bold">
|
||||
<VscSymbolEnumMember aria-hidden className="flex-shrink-0" size={24} />
|
||||
Members
|
||||
</h2>
|
||||
|
||||
<div className="flex flex-col gap-4">
|
||||
{node.map((enumMember: any, idx: number) => (
|
||||
<Fragment key={`${enumMember.displayName}-${idx}`}>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex place-content-between place-items-center gap-1">
|
||||
<h3
|
||||
className={`${ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group px-2 font-mono font-semibold break-all`}
|
||||
id={enumMember.displayName}
|
||||
>
|
||||
<Badges node={enumMember} />
|
||||
<span>
|
||||
<Link
|
||||
className="float-left -ml-6 hidden pr-2 pb-2 group-hover:block"
|
||||
href={`#${enumMember.displayName}`}
|
||||
>
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
{enumMember.displayName}
|
||||
{enumMember.parameters?.length ? (
|
||||
<ParameterNode node={enumMember.parameters} version={version} />
|
||||
) : null}
|
||||
{enumMember.initializerExcerpt ? (
|
||||
<>
|
||||
{' = '}
|
||||
<ExcerptNode node={enumMember.initializerExcerpt} version={version} />
|
||||
</>
|
||||
) : null}
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
<a
|
||||
aria-label="Open source file in new tab"
|
||||
className="min-w-min"
|
||||
href={
|
||||
enumMember.sourceLine ? `${enumMember.sourceURL}#L${enumMember.sourceLine}` : enumMember.sourceURL
|
||||
}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
<Code2
|
||||
aria-hidden
|
||||
className="text-neutral-500 hover:text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300"
|
||||
size={20}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{enumMember.summary?.deprecatedBlock.length ? (
|
||||
<DeprecatedNode deprecatedBlock={enumMember.summary.deprecatedBlock} version={version} />
|
||||
) : null}
|
||||
|
||||
{enumMember.summary?.summarySection.length ? (
|
||||
<SummaryNode node={enumMember.summary.summarySection} padding version={version} />
|
||||
) : null}
|
||||
|
||||
{enumMember.summary?.exampleBlocks.length ? (
|
||||
<ExampleNode node={enumMember.summary.exampleBlocks} version={version} />
|
||||
) : null}
|
||||
|
||||
{enumMember.summary?.returnsBlock.length ? (
|
||||
<ReturnNode node={enumMember.summary.returnsBlock} padding version={version} />
|
||||
) : null}
|
||||
|
||||
{enumMember.inheritedFrom ? (
|
||||
<InheritedFromNode node={enumMember.inheritedFrom} packageName={packageName} version={version} />
|
||||
) : null}
|
||||
|
||||
{enumMember.summary?.seeBlocks.length ? (
|
||||
<SeeNode node={enumMember.summary.seeBlocks} padding version={version} />
|
||||
) : null}
|
||||
</div>
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
import { VscSymbolEvent } from '@react-icons/all-files/vsc/VscSymbolEvent';
|
||||
import { ChevronDown, ChevronUp, Code2, LinkIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { ENV } from '@/util/env';
|
||||
import { Badges } from './Badges';
|
||||
import { DeprecatedNode } from './DeprecatedNode';
|
||||
import { ExampleNode } from './ExampleNode';
|
||||
import { InheritedFromNode } from './InheritedFromNode';
|
||||
import { ParameterNode } from './ParameterNode';
|
||||
import { ReturnNode } from './ReturnNode';
|
||||
import { SeeNode } from './SeeNode';
|
||||
import { SummaryNode } from './SummaryNode';
|
||||
import { TypeParameterNode } from './TypeParameterNode';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/Collapsible';
|
||||
import { Tab, TabList, TabPanel, Tabs } from './ui/Tabs';
|
||||
|
||||
async function EventBodyNode({
|
||||
event,
|
||||
packageName,
|
||||
version,
|
||||
overload = false,
|
||||
}: {
|
||||
readonly event: any;
|
||||
readonly overload?: boolean;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex place-content-between place-items-center gap-1">
|
||||
<h3
|
||||
className={`${overload ? (ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-24' : 'scroll-mt-16') : ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group px-2 font-mono font-semibold break-all`}
|
||||
id={event.displayName}
|
||||
>
|
||||
<Badges node={event} /> {event.displayName}
|
||||
<span>
|
||||
<Link className="float-left -ml-6 hidden pr-2 pb-2 group-hover:block" href={`#${event.displayName}`}>
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
{event.typeParameters?.length ? (
|
||||
<>
|
||||
{'<'}
|
||||
<TypeParameterNode node={event.typeParameters} version={version} />
|
||||
{'>'}
|
||||
</>
|
||||
) : null}
|
||||
({event.parameters?.length ? <ParameterNode node={event.parameters} version={version} /> : null})
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
<a
|
||||
aria-label="Open source file in new tab"
|
||||
className="min-w-min"
|
||||
href={event.sourceLine ? `${event.sourceURL}#L${event.sourceLine}` : event.sourceURL}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
<Code2
|
||||
aria-hidden
|
||||
className="text-neutral-500 hover:text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300"
|
||||
size={20}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{event.summary?.deprecatedBlock.length ? (
|
||||
<DeprecatedNode deprecatedBlock={event.summary.deprecatedBlock} version={version} />
|
||||
) : null}
|
||||
|
||||
{event.summary?.summarySection.length ? (
|
||||
<SummaryNode node={event.summary.summarySection} padding version={version} />
|
||||
) : null}
|
||||
|
||||
{event.summary?.exampleBlocks.length ? (
|
||||
<ExampleNode node={event.summary.exampleBlocks} version={version} />
|
||||
) : null}
|
||||
|
||||
{event.summary?.returnsBlock.length ? (
|
||||
<ReturnNode node={event.summary.returnsBlock} padding version={version} />
|
||||
) : null}
|
||||
|
||||
{event.inheritedFrom ? (
|
||||
<InheritedFromNode node={event.inheritedFrom} packageName={packageName} version={version} />
|
||||
) : null}
|
||||
|
||||
{event.summary?.seeBlocks.length ? <SeeNode node={event.summary.seeBlocks} padding version={version} /> : null}
|
||||
</div>
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function OverloadNode({
|
||||
event,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly event: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<Tabs className="flex flex-col gap-4">
|
||||
<TabList className="flex gap-2">
|
||||
{event.overloads.map((overload: any) => (
|
||||
<Tab
|
||||
className="cursor-pointer rounded-full bg-neutral-800/10 px-2 py-1 font-sans text-sm leading-none font-normal text-neutral-800 hover:bg-neutral-800/20 data-[selected]:bg-neutral-500 data-[selected]:text-neutral-100 dark:bg-neutral-200/10 dark:text-neutral-200 dark:hover:bg-neutral-200/20 dark:data-[selected]:bg-neutral-500/70"
|
||||
id={`overload-${overload.displayName}-${overload.overloadIndex}`}
|
||||
key={`overload-tab-${overload.displayName}-${overload.overloadIndex}`}
|
||||
>
|
||||
<span>Overload {overload.overloadIndex}</span>
|
||||
</Tab>
|
||||
))}
|
||||
</TabList>
|
||||
{event.overloads.map((overload: any) => (
|
||||
<TabPanel
|
||||
className="flex flex-col gap-4"
|
||||
id={`overload-${overload.displayName}-${overload.overloadIndex}`}
|
||||
key={`overload-tab-panel-${overload.displayName}-${overload.overloadIndex}`}
|
||||
>
|
||||
<EventBodyNode event={overload} overload packageName={packageName} version={version} />
|
||||
</TabPanel>
|
||||
))}
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
export async function EventNode({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<Collapsible className="flex flex-col gap-4" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h2 className="flex place-items-center gap-2 text-xl font-bold">
|
||||
<VscSymbolEvent aria-hidden className="flex-shrink-0" size={24} /> Events
|
||||
</h2>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col gap-4">
|
||||
{node.map((event: any) =>
|
||||
event.overloads?.length ? (
|
||||
<OverloadNode
|
||||
event={event}
|
||||
key={`${event.displayName}-${event.overloadIndex}`}
|
||||
packageName={packageName}
|
||||
version={version}
|
||||
/>
|
||||
) : (
|
||||
<EventBodyNode
|
||||
event={event}
|
||||
key={`${event.displayName}-${event.overloadIndex}`}
|
||||
packageName={packageName}
|
||||
version={version}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { DocNode } from './DocNode';
|
||||
|
||||
export async function ExampleNode({ node, version }: { readonly node: any; readonly version: string }) {
|
||||
return (
|
||||
<div className="pl-4 break-words">
|
||||
<span className="font-semibold">Examples:</span>
|
||||
<DocNode node={node} version={version} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
import { Fragment } from 'react';
|
||||
import { BuiltinDocumentationLinks } from '@/util/builtinDocumentationLinks';
|
||||
|
||||
export async function ExcerptNode({ node, version }: { readonly node?: any; readonly version: string }) {
|
||||
const createExcerpt = (excerpts: any, idx: number) => {
|
||||
const excerpt = Array.isArray(excerpts) ? excerpts : (excerpts.excerpts ?? [excerpts]);
|
||||
|
||||
return (
|
||||
<span
|
||||
className={
|
||||
excerpts?.type === 'Extends' || excerpts?.type === 'Implements'
|
||||
? 'after:content-[",_"] last-of-type:after:content-none'
|
||||
: ''
|
||||
}
|
||||
key={`${excerpt.text}-${idx}`}
|
||||
>
|
||||
{excerpt.map((excerpt: any, idx: number) => {
|
||||
if (excerpt.resolvedItem) {
|
||||
return (
|
||||
<Link
|
||||
className="text-base-blurple-400 hover:text-base-blurple-500 dark:hover:text-base-blurple-300"
|
||||
href={`/docs/packages/${excerpt.resolvedItem.packageName}/${excerpt.resolvedItem.version ?? version}/${excerpt.resolvedItem.uri}`}
|
||||
key={`${excerpt.resolvedItem.displayName}-${idx}`}
|
||||
// @ts-expect-error - unstable_dynamicOnHover is not part of the public types
|
||||
unstable_dynamicOnHover
|
||||
>
|
||||
{excerpt.text}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
if (excerpt.href) {
|
||||
return (
|
||||
<a
|
||||
className="text-base-blurple-400 hover:text-base-blurple-500 dark:hover:text-base-blurple-300"
|
||||
href={excerpt.href}
|
||||
key={`${excerpt.text}-${idx}`}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{excerpt.text}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
if (excerpt.text in BuiltinDocumentationLinks) {
|
||||
const href = BuiltinDocumentationLinks[excerpt.text as keyof typeof BuiltinDocumentationLinks];
|
||||
|
||||
return (
|
||||
<a
|
||||
className="text-base-blurple-400 hover:text-base-blurple-500 dark:hover:text-base-blurple-300"
|
||||
href={href}
|
||||
key={`${excerpt.text}-${idx}`}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{excerpt.text}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
return <Fragment key={`${excerpt.text}-${idx}`}>{excerpt.text}</Fragment>;
|
||||
})}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
return node?.map(createExcerpt) ?? null;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
import Image from 'next/image';
|
||||
import vercelLogo from '@/assets/powered-by-vercel.svg';
|
||||
import workersLogo from '@/assets/powered-by-workers.png';
|
||||
|
||||
export function Footer() {
|
||||
return (
|
||||
<footer className="md:pr-12 md:pl-12">
|
||||
<div className="flex flex-col flex-wrap place-content-center gap-6 pt-12 sm:flex-row md:gap-12">
|
||||
<div className="flex flex-wrap place-content-center place-items-center gap-4">
|
||||
<a
|
||||
className="rounded"
|
||||
href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
title="Vercel"
|
||||
>
|
||||
<Image
|
||||
alt="Vercel"
|
||||
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABLCAQAAAA1k5H2AAAAi0lEQVR42u3SMQEAAAgDoC251a3gL2SgmfBYBRAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAgwWEOSWBnYbKggAAAABJRU5ErkJggg=="
|
||||
height={44}
|
||||
placeholder="blur"
|
||||
src={vercelLogo}
|
||||
width={212}
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
className="rounded"
|
||||
href="https://www.cloudflare.com"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
title="Cloudflare Workers"
|
||||
>
|
||||
<Image
|
||||
alt="Cloudflare"
|
||||
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABLCAQAAAA1k5H2AAAAi0lEQVR42u3SMQEAAAgDoC251a3gL2SgmfBYBRAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAgwWEOSWBnYbKggAAAABJRU5ErkJggg=="
|
||||
height={44}
|
||||
placeholder="blur"
|
||||
priority
|
||||
src={workersLogo}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex flex-col gap-6 place-self-center sm:flex-row md:gap-12">
|
||||
<div className="flex max-w-max flex-col gap-2">
|
||||
<div className="text-lg font-semibold">Community</div>
|
||||
<div className="flex flex-col gap-1">
|
||||
<a className="rounded" href="https://discord.gg/djs" rel="external noopener noreferrer" target="_blank">
|
||||
Discord
|
||||
</a>
|
||||
<a
|
||||
className="rounded"
|
||||
href="https://github.com/discordjs/discord.js/discussions"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
GitHub discussions
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex max-w-max flex-col gap-2">
|
||||
<div className="text-lg font-semibold">Project</div>
|
||||
<div className="flex flex-col gap-1">
|
||||
<a
|
||||
className="rounded"
|
||||
href="https://github.com/discordjs/discord.js"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
discord.js
|
||||
</a>
|
||||
<a className="rounded" href="https://discord.js.org/docs" rel="noopener noreferrer" target="_blank">
|
||||
discord.js documentation
|
||||
</a>
|
||||
<a
|
||||
className="rounded"
|
||||
href="https://discord-api-types.dev"
|
||||
rel="external noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
discord-api-types
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import { FileCode2 } from 'lucide-react';
|
||||
import { Badges } from './Badges';
|
||||
import { DocKind } from './DocKind';
|
||||
import { InheritanceNode } from './InheritanceNode';
|
||||
|
||||
export async function InformationNode({ node, version }: { readonly node: any; readonly version: string }) {
|
||||
return (
|
||||
<div className="flex place-content-between place-items-center gap-1">
|
||||
<div className="flex flex-col gap-1">
|
||||
<h1 className="text-xl">
|
||||
<DocKind node={node} /> <span className="font-bold break-all">{node.displayName}</span>
|
||||
</h1>
|
||||
{node.implements ? <InheritanceNode node={node.implements} text="implements" version={version} /> : null}
|
||||
{node.extends ? <InheritanceNode node={node.extends} text="extends" version={version} /> : null}
|
||||
<Badges node={node} />
|
||||
</div>
|
||||
|
||||
<a
|
||||
aria-label="Open source file in new tab"
|
||||
className="min-w-min"
|
||||
href={node.sourceLine ? `${node.sourceURL}#L${node.sourceLine}` : node.sourceURL}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
<FileCode2
|
||||
aria-hidden
|
||||
className="text-neutral-500 hover:text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300"
|
||||
size={20}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { ExcerptNode } from './ExcerptNode';
|
||||
|
||||
export async function InheritanceNode({
|
||||
text,
|
||||
node,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly text: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<h2 className="inline-block min-w-min text-sm text-neutral-500 italic dark:text-neutral-400">{text}</h2>{' '}
|
||||
<span className="font-mono text-sm break-all">
|
||||
<ExcerptNode node={node} version={version} />
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
|
||||
export async function InheritedFromNode({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<p className="pl-4 break-words">
|
||||
<span className="font-semibold">Inherited from:</span>{' '}
|
||||
<Link
|
||||
className="text-base-blurple-400 hover:text-base-blurple-500 dark:hover:text-base-blurple-300 font-mono"
|
||||
href={`/docs/packages/${packageName}/${version}/${node}`}
|
||||
// @ts-expect-error - unstable_dynamicOnHover is not part of the public types
|
||||
unstable_dynamicOnHover
|
||||
>
|
||||
{node.slice(0, node.indexOf(':'))}
|
||||
</Link>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { Copy, CopyCheck } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useCopyToClipboard } from 'usehooks-ts';
|
||||
|
||||
export function InstallButton({ className = '' }: { readonly className?: string }) {
|
||||
const [interacted, setInteracted] = useState(false);
|
||||
const [copiedText, copyToClipboard] = useCopyToClipboard();
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => setInteracted(false), 2_000);
|
||||
return () => clearTimeout(timer);
|
||||
}, [interacted]);
|
||||
|
||||
return (
|
||||
<button
|
||||
className={`cursor-copy rounded-sm border border-neutral-300 bg-white px-4 py-2 font-mono hover:bg-neutral-200 dark:border-neutral-700 dark:bg-transparent dark:hover:bg-neutral-800 ${className}`}
|
||||
onClick={async () => {
|
||||
setInteracted(true);
|
||||
await copyToClipboard('npm install discord.js');
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span className="text-base-blurple-400 font-semibold">{'>'}</span> npm install discord.js{' '}
|
||||
{copiedText && interacted ? (
|
||||
<CopyCheck aria-hidden className="ml-1 inline-block text-green-500" size={20} />
|
||||
) : (
|
||||
<Copy aria-hidden className="ml-1 inline-block" size={20} />
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
|
||||
import { ChevronDown, ChevronUp, Code2, LinkIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { ENV } from '@/util/env';
|
||||
import { Badges } from './Badges';
|
||||
import { DeprecatedNode } from './DeprecatedNode';
|
||||
import { ExampleNode } from './ExampleNode';
|
||||
import { ExcerptNode } from './ExcerptNode';
|
||||
import { InheritedFromNode } from './InheritedFromNode';
|
||||
import { ParameterNode } from './ParameterNode';
|
||||
import { ReturnNode } from './ReturnNode';
|
||||
import { SeeNode } from './SeeNode';
|
||||
import { SummaryNode } from './SummaryNode';
|
||||
import { TypeParameterNode } from './TypeParameterNode';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/Collapsible';
|
||||
import { Tab, TabList, TabPanel, Tabs } from './ui/Tabs';
|
||||
|
||||
async function MethodBodyNode({
|
||||
method,
|
||||
packageName,
|
||||
version,
|
||||
overload = false,
|
||||
}: {
|
||||
readonly method: any;
|
||||
readonly overload?: boolean;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex place-content-between place-items-center gap-1">
|
||||
<h3
|
||||
className={`${overload ? (ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-24' : 'scroll-mt-16') : ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group px-2 font-mono font-semibold break-all`}
|
||||
id={method.displayName}
|
||||
>
|
||||
<Badges node={method} /> {method.displayName}
|
||||
<span>
|
||||
<Link className="float-left -ml-6 hidden pr-2 pb-2 group-hover:block" href={`#${method.displayName}`}>
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
{method.typeParameters?.length ? (
|
||||
<>
|
||||
{'<'}
|
||||
<TypeParameterNode node={method.typeParameters} version={version} />
|
||||
{'>'}
|
||||
</>
|
||||
) : null}
|
||||
({method.parameters?.length ? <ParameterNode node={method.parameters} version={version} /> : null}
|
||||
) : <ExcerptNode node={method.returnTypeExcerpt} version={version} />
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
<a
|
||||
aria-label="Open source file in new tab"
|
||||
className="min-w-min"
|
||||
href={method.sourceLine ? `${method.sourceURL}#L${method.sourceLine}` : method.sourceURL}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
<Code2
|
||||
aria-hidden
|
||||
className="text-neutral-500 hover:text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300"
|
||||
size={20}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{method.summary?.deprecatedBlock.length ? (
|
||||
<DeprecatedNode deprecatedBlock={method.summary.deprecatedBlock} version={version} />
|
||||
) : null}
|
||||
|
||||
{method.summary?.summarySection.length ? (
|
||||
<SummaryNode node={method.summary.summarySection} padding version={version} />
|
||||
) : null}
|
||||
|
||||
{method.summary?.exampleBlocks.length ? (
|
||||
<ExampleNode node={method.summary.exampleBlocks} version={version} />
|
||||
) : null}
|
||||
|
||||
{method.summary?.returnsBlock.length ? (
|
||||
<ReturnNode node={method.summary.returnsBlock} padding version={version} />
|
||||
) : null}
|
||||
|
||||
{method.inheritedFrom ? (
|
||||
<InheritedFromNode node={method.inheritedFrom} packageName={packageName} version={version} />
|
||||
) : null}
|
||||
|
||||
{method.summary?.seeBlocks.length ? (
|
||||
<SeeNode node={method.summary.seeBlocks} padding version={version} />
|
||||
) : null}
|
||||
</div>
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function OverloadNode({
|
||||
method,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly method: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<Tabs className="flex flex-col gap-4">
|
||||
<TabList className="flex gap-2">
|
||||
{method.overloads.map((overload: any) => (
|
||||
<Tab
|
||||
className="cursor-pointer rounded-full bg-neutral-800/10 px-2 py-1 font-sans text-sm leading-none font-normal text-neutral-800 hover:bg-neutral-800/20 data-[selected]:bg-neutral-500 data-[selected]:text-neutral-100 dark:bg-neutral-200/10 dark:text-neutral-200 dark:hover:bg-neutral-200/20 dark:data-[selected]:bg-neutral-500/70"
|
||||
id={`overload-${overload.displayName}-${overload.overloadIndex}`}
|
||||
key={`overload-tab-${overload.displayName}-${overload.overloadIndex}`}
|
||||
>
|
||||
<span>Overload {overload.overloadIndex}</span>
|
||||
</Tab>
|
||||
))}
|
||||
</TabList>
|
||||
{method.overloads.map((overload: any) => (
|
||||
<TabPanel
|
||||
className="flex flex-col gap-4"
|
||||
id={`overload-${overload.displayName}-${overload.overloadIndex}`}
|
||||
key={`overload-tab-panel-${overload.displayName}-${overload.overloadIndex}`}
|
||||
>
|
||||
<MethodBodyNode method={overload} overload packageName={packageName} version={version} />
|
||||
</TabPanel>
|
||||
))}
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
export async function MethodNode({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<Collapsible className="flex flex-col gap-4" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h2 className="flex place-items-center gap-2 text-xl font-bold">
|
||||
<VscSymbolMethod aria-hidden className="flex-shrink-0" size={24} /> Methods
|
||||
</h2>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col gap-4">
|
||||
{node.map((method: any) =>
|
||||
method.overloads?.length ? (
|
||||
<OverloadNode
|
||||
key={`${method.displayName}-${method.overloadIndex}`}
|
||||
method={method}
|
||||
packageName={packageName}
|
||||
version={version}
|
||||
/>
|
||||
) : (
|
||||
<MethodBodyNode
|
||||
key={`${method.displayName}-${method.overloadIndex}`}
|
||||
method={method}
|
||||
packageName={packageName}
|
||||
version={version}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
);
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
import { ChevronDown, ChevronUp } from 'lucide-react';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { fetchSitemap } from '@/util/fetchSitemap';
|
||||
import { resolveNodeKind } from './DocKind';
|
||||
import { NavigationItem } from './NavigationItem';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/Collapsible';
|
||||
|
||||
export async function Navigation({ packageName, version }: { readonly packageName: string; readonly version: string }) {
|
||||
const node = await fetchSitemap({ packageName, version });
|
||||
|
||||
if (!node) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const groupedNodes = node.reduce((acc: any, node: any) => {
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
(acc[node.kind.toLowerCase()] ||= []).push(node);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return (
|
||||
<nav className="flex flex-col gap-2 pr-3">
|
||||
{groupedNodes.class?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h4 className="font-semibold">Classes</h4>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col">
|
||||
{groupedNodes.class.map((node: any, idx: number) => {
|
||||
const kind = resolveNodeKind(node.kind);
|
||||
return (
|
||||
<NavigationItem key={`${node.name}-${idx}`} node={node} packageName={packageName} version={version}>
|
||||
<div className={`inline-block h-6 w-6 rounded-full text-center ${kind.background} ${kind.text}`}>
|
||||
{node.kind[0]}
|
||||
</div>{' '}
|
||||
<span className="font-sans">{node.name}</span>
|
||||
</NavigationItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
|
||||
{groupedNodes.function?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h4 className="font-semibold">Functions</h4>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col">
|
||||
{groupedNodes.function.map((node: any, idx: number) => {
|
||||
const kind = resolveNodeKind(node.kind);
|
||||
return (
|
||||
<NavigationItem key={`${node.name}-${idx}`} node={node} packageName={packageName} version={version}>
|
||||
<div className={`inline-block h-6 w-6 rounded-full text-center ${kind.background} ${kind.text}`}>
|
||||
{node.kind[0]}
|
||||
</div>{' '}
|
||||
<span className="font-sans">{node.name}</span>
|
||||
</NavigationItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
|
||||
{groupedNodes.enum?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h4 className="font-semibold">Enums</h4>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col">
|
||||
{groupedNodes.enum.map((node: any, idx: number) => {
|
||||
const kind = resolveNodeKind(node.kind);
|
||||
return (
|
||||
<NavigationItem key={`${node.name}-${idx}`} node={node} packageName={packageName} version={version}>
|
||||
<div className={`inline-block h-6 w-6 rounded-full text-center ${kind.background} ${kind.text}`}>
|
||||
{node.kind[0]}
|
||||
</div>{' '}
|
||||
<span className="font-sans">{node.name}</span>
|
||||
</NavigationItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
|
||||
{groupedNodes.interface?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h4 className="font-semibold">Interfaces</h4>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col">
|
||||
{groupedNodes.interface.map((node: any, idx: number) => {
|
||||
const kind = resolveNodeKind(node.kind);
|
||||
return (
|
||||
<NavigationItem key={`${node.name}-${idx}`} node={node} packageName={packageName} version={version}>
|
||||
<div className={`inline-block h-6 w-6 rounded-full text-center ${kind.background} ${kind.text}`}>
|
||||
{node.kind[0]}
|
||||
</div>{' '}
|
||||
<span className="font-sans">{node.name}</span>
|
||||
</NavigationItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
|
||||
{groupedNodes.typealias?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h4 className="font-semibold">Types</h4>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col">
|
||||
{groupedNodes.typealias.map((node: any, idx: number) => {
|
||||
const kind = resolveNodeKind(node.kind);
|
||||
return (
|
||||
<NavigationItem key={`${node.name}-${idx}`} node={node} packageName={packageName} version={version}>
|
||||
<div className={`inline-block h-6 w-6 rounded-full text-center ${kind.background} ${kind.text}`}>
|
||||
{node.kind[0]}
|
||||
</div>{' '}
|
||||
<span className="font-sans">{node.name}</span>
|
||||
</NavigationItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
|
||||
{groupedNodes.variable?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h4 className="font-semibold">Variables</h4>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col">
|
||||
{groupedNodes.variable.map((node: any, idx: number) => {
|
||||
const kind = resolveNodeKind(node.kind);
|
||||
return (
|
||||
<NavigationItem key={`${node.name}-${idx}`} node={node} packageName={packageName} version={version}>
|
||||
<div className={`inline-block h-6 w-6 rounded-full text-center ${kind.background} ${kind.text}`}>
|
||||
{node.kind[0]}
|
||||
</div>{' '}
|
||||
<span className="font-sans">{node.name}</span>
|
||||
</NavigationItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { useSetAtom } from 'jotai';
|
||||
import Link from 'next/link';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { isDrawerOpenAtom } from '@/stores/drawer';
|
||||
import { cx } from '@/styles/cva';
|
||||
|
||||
export function NavigationItem({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
children,
|
||||
}: PropsWithChildren<{
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}>) {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const setDrawerOpen = useSetAtom(isDrawerOpenAtom);
|
||||
|
||||
const href = `/docs/packages/${packageName}/${version}/${node.href}`;
|
||||
|
||||
return (
|
||||
<Link
|
||||
className={cx(
|
||||
'dark:hover:text-base-neutral-40 hover:text-base-neutral-900 truncate rounded-lg p-2 font-mono text-[#676771] transition-colors hover:bg-[#e7e7e9] active:bg-[#e4e4e7] md:py-1 dark:text-[#83838b] dark:hover:bg-[#1d1d1e] dark:active:bg-[#27272b]',
|
||||
pathname === href &&
|
||||
'dark:text-base-neutral-40 text-base-neutral-900 bg-[#d9d9dc] font-medium dark:bg-[#323235] dark:hover:bg-[#323235]',
|
||||
)}
|
||||
href={href}
|
||||
onClick={() => setDrawerOpen(false)}
|
||||
onMouseEnter={() => router.prefetch(href)}
|
||||
onTouchStart={() => router.prefetch(href)}
|
||||
prefetch={false}
|
||||
title={node.name}
|
||||
// @ts-expect-error - unstable_dynamicOnHover is not part of the public types
|
||||
unstable_dynamicOnHover
|
||||
>
|
||||
{children}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
import { VscListSelection } from '@react-icons/all-files/vsc/VscListSelection';
|
||||
import { VscSymbolEvent } from '@react-icons/all-files/vsc/VscSymbolEvent';
|
||||
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
|
||||
import { VscSymbolProperty } from '@react-icons/all-files/vsc/VscSymbolProperty';
|
||||
import { ChevronDown, ChevronUp } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { Fragment } from 'react';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/Collapsible';
|
||||
|
||||
export async function Outline({ node }: { readonly node: any }) {
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
const hasAny = node.members?.properties?.length || node.members?.events?.length || node.members?.methods?.length;
|
||||
|
||||
return hasAny ? (
|
||||
<Collapsible className="flex flex-col gap-4" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h2 className="flex place-items-center gap-2 text-xl font-bold">
|
||||
<VscListSelection aria-hidden className="flex-shrink-0" size={24} /> Table of contents
|
||||
</h2>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="grid gap-2 sm:grid-cols-2">
|
||||
{node.members?.properties?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h2 className="flex place-items-center gap-2 text-xl font-bold">
|
||||
<VscSymbolProperty aria-hidden className="flex-shrink-0" size={24} />
|
||||
Properties
|
||||
</h2>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col px-4">
|
||||
{node.members.properties.map((property: any, idx: number) => (
|
||||
<Fragment key={`${property.displayName}-${idx}`}>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex place-content-between place-items-center">
|
||||
<Link
|
||||
className="max-w-[25ch] grow truncate rounded-md p-2 font-mono transition-colors hover:bg-[#e7e7e9] md:max-w-none md:py-1 dark:hover:bg-[#242428]"
|
||||
href={`#${property.displayName}`}
|
||||
>
|
||||
{property.displayName}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
|
||||
{node.members?.methods?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h2 className="flex place-items-center gap-2 text-xl font-bold">
|
||||
<VscSymbolMethod aria-hidden className="flex-shrink-0" size={24} />
|
||||
Methods
|
||||
</h2>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col px-4">
|
||||
{node.members.methods.map((method: any, idx: number) => (
|
||||
<Fragment key={`${method.displayName}-${idx}`}>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex place-content-between place-items-center">
|
||||
<Link
|
||||
className="max-w-[25ch] grow truncate rounded-md p-2 font-mono transition-colors hover:bg-[#e7e7e9] md:max-w-none md:py-1 dark:hover:bg-[#242428]"
|
||||
href={`#${method.displayName}`}
|
||||
>
|
||||
{method.displayName}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
|
||||
{node.members?.events?.length ? (
|
||||
<Collapsible className="flex flex-col gap-2" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h2 className="flex place-items-center gap-2 text-xl font-bold">
|
||||
<VscSymbolEvent aria-hidden className="flex-shrink-0" size={24} />
|
||||
Events
|
||||
</h2>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col px-4">
|
||||
{node.members.events.map((event: any, idx: number) => (
|
||||
<Fragment key={`${event.displayName}-${idx}`}>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex place-content-between place-items-center">
|
||||
<Link
|
||||
className="max-w-[25ch] grow truncate rounded-md p-2 font-mono transition-colors hover:bg-[#e7e7e9] md:max-w-none md:py-1 dark:hover:bg-[#242428]"
|
||||
href={`#${event.displayName}`}
|
||||
>
|
||||
{event.displayName}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
</div>
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { OverlayScrollbars, ClickScrollPlugin } from 'overlayscrollbars';
|
||||
import type { OverlayScrollbarsComponentProps } from 'overlayscrollbars-react';
|
||||
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
|
||||
import { cx } from '@/styles/cva';
|
||||
|
||||
OverlayScrollbars.plugin(ClickScrollPlugin);
|
||||
|
||||
export function Scrollbars(props: OverlayScrollbarsComponentProps) {
|
||||
const { className, children, ...additionalProps } = props;
|
||||
|
||||
return (
|
||||
<OverlayScrollbarsComponent {...additionalProps} className={cx('', className)} defer>
|
||||
{children}
|
||||
</OverlayScrollbarsComponent>
|
||||
);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { useParams, useRouter } from 'next/navigation';
|
||||
import { Select, SelectList, SelectOption, SelectTrigger } from '@/components/ui/Select';
|
||||
import { PACKAGES } from '@/util/constants';
|
||||
|
||||
export function PackageSelect() {
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
|
||||
return (
|
||||
<Select aria-label="Select a package" defaultSelectedKey={params.packageName as string}>
|
||||
<SelectTrigger className="bg-[#f3f3f4] dark:bg-[#121214]" />
|
||||
<SelectList classNames={{ popover: 'bg-[#f3f3f4] dark:bg-[#28282d]' }} items={PACKAGES}>
|
||||
{(item) => (
|
||||
<SelectOption
|
||||
className="dark:pressed:bg-[#313135] bg-[#f3f3f4] dark:bg-[#28282d] dark:hover:bg-[#313135]"
|
||||
href={`/docs/packages/${item.name}/stable`}
|
||||
id={item.name}
|
||||
key={item.name}
|
||||
onHoverStart={() => router.prefetch(`/docs/packages/${item.name}/stable`)}
|
||||
textValue={item.name}
|
||||
>
|
||||
{item.name}
|
||||
</SelectOption>
|
||||
)}
|
||||
</SelectList>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
import { LinkIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { Fragment } from 'react';
|
||||
import { Badges } from './Badges';
|
||||
import { DocNode } from './DocNode';
|
||||
import { ExcerptNode } from './ExcerptNode';
|
||||
|
||||
export async function ParameterNode({
|
||||
description = false,
|
||||
node,
|
||||
version,
|
||||
}: {
|
||||
readonly description?: boolean;
|
||||
readonly node: any;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<div className={`${description ? 'flex flex-col gap-4' : 'inline'}`}>
|
||||
{node.map((parameter: any, idx: number) => (
|
||||
<Fragment key={`${parameter.name}-${idx}`}>
|
||||
<div className={description ? 'group' : 'inline after:content-[",_"] last-of-type:after:content-none'}>
|
||||
<span className="font-mono font-semibold">
|
||||
{description ? (
|
||||
<Link className="float-left -ml-6 hidden pr-2 pb-2 group-hover:block" href={`#${parameter.name}`}>
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
) : null}
|
||||
{description ? <Badges node={parameter} /> : null}
|
||||
{parameter.name}
|
||||
{parameter.isOptional ? '?' : ''}: <ExcerptNode node={parameter.typeExcerpt} version={version} />
|
||||
{parameter.defaultValue ? ` = ${parameter.defaultValue}` : ''}
|
||||
</span>
|
||||
{description && parameter.description?.length ? (
|
||||
<div className="mt-4 pl-4">
|
||||
<DocNode node={parameter.description} version={version} />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
{description ? (
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
import { VscSymbolProperty } from '@react-icons/all-files/vsc/VscSymbolProperty';
|
||||
import { ChevronDown, ChevronUp, Code2, LinkIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { Fragment } from 'react';
|
||||
import { ENV } from '@/util/env';
|
||||
import { Badges } from './Badges';
|
||||
import { DeprecatedNode } from './DeprecatedNode';
|
||||
import { ExcerptNode } from './ExcerptNode';
|
||||
import { InheritedFromNode } from './InheritedFromNode';
|
||||
import { SeeNode } from './SeeNode';
|
||||
import { SummaryNode } from './SummaryNode';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/Collapsible';
|
||||
|
||||
export async function PropertyNode({
|
||||
node,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<Collapsible className="flex flex-col gap-4" defaultOpen>
|
||||
<CollapsibleTrigger className="group flex place-content-between place-items-center rounded-md p-2 hover:bg-[#e7e7e9] dark:hover:bg-[#242428]">
|
||||
<h2 className="flex place-items-center gap-2 text-xl font-bold">
|
||||
<VscSymbolProperty aria-hidden className="flex-shrink-0" size={24} />
|
||||
Properties
|
||||
</h2>
|
||||
<ChevronDown aria-hidden className='group-data-[state="open"]:hidden' size={24} />
|
||||
<ChevronUp aria-hidden className='group-data-[state="closed"]:hidden' size={24} />
|
||||
</CollapsibleTrigger>
|
||||
|
||||
<CollapsibleContent>
|
||||
<div className="flex flex-col gap-4">
|
||||
{node.map((property: any, idx: number) => (
|
||||
<Fragment key={`${property.displayName}-${idx}`}>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex place-content-between place-items-center gap-1">
|
||||
<h3
|
||||
className={`${ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group flex flex-col gap-2 px-2 font-mono font-semibold break-words`}
|
||||
id={property.displayName}
|
||||
>
|
||||
<Badges node={property} />
|
||||
<span>
|
||||
<Link
|
||||
className="float-left -ml-6 hidden pr-2 pb-2 group-hover:block"
|
||||
href={`#${property.displayName}`}
|
||||
>
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
{property.displayName}
|
||||
{property.isOptional ? '?' : ''} : <ExcerptNode node={property.typeExcerpt} version={version} />{' '}
|
||||
{property.summary?.defaultValueBlock.length
|
||||
? `= ${property.summary.defaultValueBlock.reduce(
|
||||
(acc: string, def: { kind: string; text: string }) => `${acc}${def.text}`,
|
||||
'',
|
||||
)}`
|
||||
: ''}
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
<a
|
||||
aria-label="Open source file in new tab"
|
||||
className="min-w-min"
|
||||
href={property.sourceLine ? `${property.sourceURL}#L${property.sourceLine}` : property.sourceURL}
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
<Code2
|
||||
aria-hidden
|
||||
className="text-neutral-500 hover:text-neutral-600 dark:text-neutral-400 dark:hover:text-neutral-300"
|
||||
size={20}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{property.summary?.deprecatedBlock.length ? (
|
||||
<DeprecatedNode deprecatedBlock={property.summary.deprecatedBlock} version={version} />
|
||||
) : null}
|
||||
|
||||
{property.summary?.summarySection.length ? (
|
||||
<SummaryNode node={property.summary.summarySection} padding version={version} />
|
||||
) : null}
|
||||
|
||||
{property.inheritedFrom ? (
|
||||
<InheritedFromNode node={property.inheritedFrom} packageName={packageName} version={version} />
|
||||
) : null}
|
||||
|
||||
{property.summary?.seeBlocks.length ? (
|
||||
<SeeNode node={property.summary.seeBlocks} padding version={version} />
|
||||
) : null}
|
||||
</div>
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { DocNode } from './DocNode';
|
||||
|
||||
export async function ReturnNode({
|
||||
padding = false,
|
||||
node,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly padding?: boolean;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<p className={`break-words ${padding ? 'pl-4' : ''}`}>
|
||||
<span className="font-semibold">Returns:</span> <DocNode node={node} version={version} />
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { Command, Search } from 'lucide-react';
|
||||
import { isCmdKOpenAtom } from '@/stores/cmdk';
|
||||
import { useSidebar } from './ui/Sidebar';
|
||||
|
||||
export function SearchButton() {
|
||||
const { setOpenMobile } = useSidebar();
|
||||
const setIsOpen = useSetAtom(isCmdKOpenAtom);
|
||||
|
||||
return (
|
||||
<button
|
||||
aria-label="Open search"
|
||||
className="bg-base-neutral-100 dark:bg-base-neutral-900 flex place-content-between place-items-center rounded-sm p-2"
|
||||
onClick={() => {
|
||||
setOpenMobile(false);
|
||||
setIsOpen(true);
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span className="flex place-items-center gap-2">
|
||||
<Search aria-hidden size={18} />
|
||||
Search...
|
||||
</span>
|
||||
<span className="hidden place-items-center gap-1 md:flex">
|
||||
<Command aria-hidden size={18} /> K
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { DocNode } from './DocNode';
|
||||
|
||||
export async function SeeNode({
|
||||
padding = false,
|
||||
node,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly padding?: boolean;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<p className={`break-words ${padding ? 'pl-4' : ''}`}>
|
||||
<span className="font-semibold">See also:</span> <DocNode node={node} version={version} />
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { DocNode } from './DocNode';
|
||||
|
||||
export async function SummaryNode({
|
||||
padding = false,
|
||||
node,
|
||||
version,
|
||||
}: {
|
||||
readonly node: any;
|
||||
readonly padding?: boolean;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<p className={`break-words ${padding ? 'pl-4' : ''}`}>
|
||||
<DocNode node={node} version={version} />
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import { codeToHtml } from '@/util/shiki.bundle';
|
||||
|
||||
export async function SyntaxHighlighter({
|
||||
lang,
|
||||
code,
|
||||
className = '',
|
||||
}: {
|
||||
readonly className?: string;
|
||||
readonly code: string;
|
||||
readonly lang: string;
|
||||
}) {
|
||||
const codeHTML = await codeToHtml(code.trim(), {
|
||||
lang,
|
||||
themes: {
|
||||
light: 'github-light',
|
||||
dark: 'github-dark-dimmed',
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* eslint-disable-next-line react/no-danger */}
|
||||
<div className={className} dangerouslySetInnerHTML={{ __html: codeHTML }} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { VscColorMode } from '@react-icons/all-files/vsc/VscColorMode';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
|
||||
export function ThemeSwitch() {
|
||||
const { resolvedTheme, setTheme } = useTheme();
|
||||
const toggleTheme = () => setTheme(resolvedTheme === 'light' ? 'dark' : 'light');
|
||||
|
||||
return (
|
||||
<Button aria-label="Toggle theme" onPress={() => toggleTheme()} size="icon-sm" variant="filled">
|
||||
<VscColorMode aria-hidden data-slot="icon" size={18} />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export const ThemeSwitchNoSRR = dynamic(async () => ThemeSwitch, {
|
||||
ssr: false,
|
||||
});
|
||||
@@ -1,71 +0,0 @@
|
||||
import { LinkIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { Fragment } from 'react';
|
||||
import { cx } from '@/styles/cva';
|
||||
import { ENV } from '@/util/env';
|
||||
import { Badges } from './Badges';
|
||||
import { DocNode } from './DocNode';
|
||||
import { ExcerptNode } from './ExcerptNode';
|
||||
|
||||
export async function TypeParameterNode({
|
||||
description = false,
|
||||
node,
|
||||
version,
|
||||
}: {
|
||||
readonly description?: boolean;
|
||||
readonly node: any;
|
||||
readonly version: string;
|
||||
}) {
|
||||
return (
|
||||
<div className={`${description ? 'flex flex-col gap-4' : 'inline-block'}`}>
|
||||
{node.map((typeParameter: any, idx: number) => (
|
||||
<Fragment key={`${typeParameter.name}-${idx}`}>
|
||||
<div className={description ? '' : 'inline after:content-[",_"] last-of-type:after:content-none'}>
|
||||
<h3
|
||||
className={cx(
|
||||
ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8',
|
||||
'group inline font-mono font-semibold break-words',
|
||||
description ? 'inline-block px-2' : '',
|
||||
)}
|
||||
id={typeParameter.name}
|
||||
>
|
||||
{description ? <Badges node={typeParameter} /> : null}
|
||||
<span>
|
||||
{description ? (
|
||||
<Link className="float-left -ml-6 hidden pr-2 pb-2 group-hover:block" href={`#${typeParameter.name}`}>
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
) : null}
|
||||
{typeParameter.name}
|
||||
{typeParameter.isOptional ? '?' : ''}
|
||||
{typeParameter.constraintsExcerpt.length ? (
|
||||
<>
|
||||
{' extends '}
|
||||
<ExcerptNode node={typeParameter.constraintsExcerpt} version={version} />
|
||||
</>
|
||||
) : null}
|
||||
{typeParameter.defaultExcerpt.length ? (
|
||||
<>
|
||||
{' = '}
|
||||
<ExcerptNode node={typeParameter.defaultExcerpt} version={version} />
|
||||
</>
|
||||
) : null}
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
{description && typeParameter.description?.length ? (
|
||||
<div className="pl-4">
|
||||
<DocNode node={typeParameter.description} version={version} />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
{description ? (
|
||||
<div aria-hidden className="p-4">
|
||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import { ExcerptNode } from './ExcerptNode';
|
||||
|
||||
export async function UnionMember({ node, version }: { readonly node: any; readonly version: string }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
{node.length > 1 ? <h2 className="flex place-items-center gap-2 p-2 text-xl font-bold">Union Members</h2> : null}
|
||||
|
||||
<span className="flex flex-col gap-4 px-2 font-mono text-sm break-words">
|
||||
<ExcerptNode node={node} version={version} />
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { useParams, useRouter } from 'next/navigation';
|
||||
import { use } from 'react';
|
||||
import { Select, SelectList, SelectOption, SelectTrigger } from './ui/Select';
|
||||
|
||||
export function VersionSelect({
|
||||
versionsPromise,
|
||||
}: {
|
||||
readonly versionsPromise: Promise<{ readonly version: string }[]>;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
const versions = use(versionsPromise);
|
||||
|
||||
return (
|
||||
<Select aria-label="Select a version" defaultSelectedKey={params.version as string}>
|
||||
<SelectTrigger className="bg-[#f3f3f4] dark:bg-[#121214]" />
|
||||
<SelectList classNames={{ popover: 'bg-[#f3f3f4] dark:bg-[#28282d]' }} items={versions}>
|
||||
{(item) => (
|
||||
<SelectOption
|
||||
className="dark:pressed:bg-[#313135] bg-[#f3f3f4] dark:bg-[#28282d] dark:hover:bg-[#313135]"
|
||||
href={`/docs/packages/${params.packageName}/${item.version}`}
|
||||
id={item.version}
|
||||
key={item.version}
|
||||
onHoverStart={() => router.prefetch(`/docs/packages/${params.packageName}/${item.version}`)}
|
||||
textValue={item.version}
|
||||
>
|
||||
{item.version}
|
||||
</SelectOption>
|
||||
)}
|
||||
</SelectList>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
import { VscFlame } from '@react-icons/all-files/vsc/VscFlame';
|
||||
import { VscInfo } from '@react-icons/all-files/vsc/VscInfo';
|
||||
import { VscWarning } from '@react-icons/all-files/vsc/VscWarning';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
|
||||
interface IAlert {
|
||||
readonly title?: string | undefined;
|
||||
readonly type: 'danger' | 'info' | 'success' | 'warning';
|
||||
}
|
||||
|
||||
function resolveType(type: IAlert['type']) {
|
||||
switch (type) {
|
||||
case 'danger': {
|
||||
return {
|
||||
text: 'text-red-500',
|
||||
border: 'border-red-500',
|
||||
icon: <VscWarning aria-hidden size={20} />,
|
||||
};
|
||||
}
|
||||
|
||||
case 'info': {
|
||||
return {
|
||||
text: 'text-blue-500',
|
||||
border: 'border-blue-500',
|
||||
icon: <VscInfo aria-hidden size={20} />,
|
||||
};
|
||||
}
|
||||
|
||||
case 'success': {
|
||||
return {
|
||||
text: 'text-green-500',
|
||||
border: 'border-green-500',
|
||||
icon: <VscFlame aria-hidden size={20} />,
|
||||
};
|
||||
}
|
||||
|
||||
case 'warning': {
|
||||
return {
|
||||
text: 'text-yellow-500',
|
||||
border: 'border-yellow-500',
|
||||
icon: <VscWarning aria-hidden size={20} />,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function Alert({ title, type, children }: PropsWithChildren<IAlert>) {
|
||||
const { text, border, icon } = resolveType(type);
|
||||
|
||||
return (
|
||||
<div className="mt-6 mb-4" role="alert">
|
||||
<div className="relative flex">
|
||||
<div className="p-4">{children}</div>
|
||||
<div className="pointer-events-none absolute flex h-full w-full">
|
||||
<div className={`w-4 shrink-0 rounded-tl-md rounded-bl-md border-t-2 border-b-2 border-l-2 ${border}`} />
|
||||
<div className={`relative border-b-2 ${border}`}>
|
||||
<div className={`pointer-events-auto flex -translate-y-1/2 place-items-center gap-2 px-2 ${text}`}>
|
||||
{icon}
|
||||
{title ? <span className={`font-semibold ${text}`}>{title}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className={`flex-1 rounded-tr-md rounded-br-md border-t-2 border-r-2 border-b-2 ${border}`} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||