Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

feat: Docs to TypeScript (tightening) (#85)

Pavel 'Strajk' Dolecekf2e3a6fa8155
diff --git a/.gitignore b/.gitignore
index 1a1d7ffdc..35592cf01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -148,7 +148,6 @@ dist/
downloads/
eggs/
.eggs/
-lib/
lib64/
parts/
sdist/
diff --git a/apps/docs/.eslintrc.json b/apps/docs/.eslintrc.json
new file mode 100644
index 000000000..bffb357a7
--- /dev/null
+++ b/apps/docs/.eslintrc.json
@@ -0,0 +1,3 @@
+{
+ "extends": "next/core-web-vitals"
+}
diff --git a/apps/docs/.prettierignore b/apps/docs/.prettierignore
new file mode 100644
index 000000000..adcd70c56
--- /dev/null
+++ b/apps/docs/.prettierignore
@@ -0,0 +1,2 @@
+/.next/
+/src/code
diff --git a/apps/docs/DEV.md b/apps/docs/DEV.md
index 4262d0a84..5b0d97a6d 100644
--- a/apps/docs/DEV.md
+++ b/apps/docs/DEV.md
@@ -5,4 +5,4 @@
- Make search appear faster
- Show the substring that matched the search in the results
- Check nextjs build config for improvements
-- Update packages in dashboard
\ No newline at end of file
+- Update packages in dashboard
diff --git a/apps/docs/jsconfig.json b/apps/docs/jsconfig.json
deleted file mode 100644
index b8d6842d7..000000000
--- a/apps/docs/jsconfig.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "compilerOptions": {
- "paths": {
- "@/*": ["./src/*"]
- }
- }
-}
diff --git a/apps/docs/mdx-components.jsx b/apps/docs/mdx-components.jsx
deleted file mode 100644
index 250fb0b79..000000000
--- a/apps/docs/mdx-components.jsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import * as mdxComponents from '@/components/mdx'
-
-export function useMDXComponents(components) {
- return {
- ...components,
- ...mdxComponents
- }
-}
diff --git a/apps/docs/mdx-components.tsx b/apps/docs/mdx-components.tsx
new file mode 100644
index 000000000..819168d27
--- /dev/null
+++ b/apps/docs/mdx-components.tsx
@@ -0,0 +1,9 @@
+import * as mdxComponents from '@/components/mdx'
+import { type MDXComponents } from 'mdx/types'
+
+export function useMDXComponents(components: MDXComponents) {
+ return {
+ ...components,
+ ...mdxComponents,
+ }
+}
diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs
index 27978020c..5aa485460 100644
--- a/apps/docs/next.config.mjs
+++ b/apps/docs/next.config.mjs
@@ -8,7 +8,7 @@ import { recmaPlugins } from './src/mdx/recma.mjs'
import { rehypePlugins } from './src/mdx/rehype.mjs'
import { remarkPlugins } from './src/mdx/remark.mjs'
import withSearch from './src/mdx/search.mjs'
-import { withSentryConfig } from '@sentry/nextjs';
+import { withSentryConfig } from '@sentry/nextjs'
const withMDX = nextMDX({
options: {
@@ -24,7 +24,6 @@ function getFilesHash(rootPath) {
const shasum = crypto.createHash('sha1')
function processFile(name, content) {
-
shasum.update(name)
// Add delimiter to hash to prevent collisions between files where the join of the name and content is the same
shasum.update(delimiter)
@@ -32,13 +31,12 @@ function getFilesHash(rootPath) {
shasum.update(delimiter)
}
- fsWalk.walkSync(rootPath, { stats: true })
- .forEach(e => {
- if (!e.stats.isDirectory()) {
- const content = fs.readFileSync(e.path, 'utf8')
- processFile(e.path, content)
- }
- })
+ fsWalk.walkSync(rootPath, { stats: true }).forEach((e) => {
+ if (!e.stats.isDirectory()) {
+ const content = fs.readFileSync(e.path, 'utf8')
+ processFile(e.path, content)
+ }
+ })
return shasum.digest('base64')
}
@@ -59,7 +57,7 @@ const nextConfig = {
{
source: '/ingest/:path*',
destination: 'https://app.posthog.com/:path*',
- basePath: false,
+ // BEWARE: setting basePath will break the analytics proxy
},
]
},
@@ -70,20 +68,27 @@ const nextConfig = {
destination: '/docs',
permanent: false,
basePath: false,
- }
+ },
]
- }
+ },
}
-export default withSearch(withMDX(withSentryConfig(nextConfig, {
- silent: true,
- org: 'e2b',
- project: 'docs'
- },
- {
- widenClientFileUpload: true,
- transpileClientSDK: true,
- tunnelRoute: '/monitoring',
- hideSourceMaps: true,
- disableLogger: true,
- })))
+export default withSearch(
+ withMDX(
+ withSentryConfig(
+ nextConfig,
+ {
+ silent: true,
+ org: 'e2b',
+ project: 'docs',
+ },
+ {
+ widenClientFileUpload: true,
+ transpileClientSDK: true,
+ tunnelRoute: '/monitoring',
+ hideSourceMaps: true,
+ disableLogger: true,
+ }
+ )
+ )
+)
diff --git a/apps/docs/package-lock.json b/apps/docs/package-lock.json
index 20e37bdbe..7c7876533 100644
--- a/apps/docs/package-lock.json
+++ b/apps/docs/package-lock.json
@@ -20,6 +20,10 @@
"@supabase/supabase-auth-helpers": "^1.4.2",
"@supabase/supabase-js": "^2.32.0",
"@tailwindcss/typography": "^0.5.8",
+ "@types/node": "20.4.7",
+ "@types/react": "18.2.18",
+ "@types/react-dom": "18.2.7",
+ "@types/react-highlight-words": "^0.16.4",
"@vercel/analytics": "^1.0.2",
"acorn": "^8.8.1",
"autoprefixer": "^10.4.7",
@@ -44,6 +48,7 @@
"shiki": "^0.11.1",
"simple-functional-loader": "^1.2.1",
"tailwindcss": "^3.3.3",
+ "typescript": "5.1.6",
"unist-util-filter": "^4.0.1",
"unist-util-visit": "^4.1.1",
"usehooks-ts": "^2.9.1",
@@ -52,10 +57,12 @@
"devDependencies": {
"@e2b/sdk": "^0.1.0",
"@nodelib/fs.walk": "^2.0.0",
+ "encoding": "^0.1.13",
"eslint": "8.45.0",
"eslint-config-next": "13.4.12",
"prettier": "^2.8.7",
- "prettier-plugin-tailwindcss": "^0.2.6"
+ "prettier-plugin-tailwindcss": "^0.2.6",
+ "sharp": "^0.32.0"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@@ -1420,9 +1427,9 @@
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
},
"node_modules/@types/node": {
- "version": "20.4.2",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz",
- "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw=="
+ "version": "20.4.7",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.7.tgz",
+ "integrity": "sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g=="
},
"node_modules/@types/phoenix": {
"version": "1.6.0",
@@ -1435,15 +1442,31 @@
"integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w=="
},
"node_modules/@types/react": {
- "version": "18.2.15",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.15.tgz",
- "integrity": "sha512-oEjE7TQt1fFTFSbf8kkNuc798ahTUzn3Le67/PWjE8MAfYAD/qB7O8hSTcromLFqHCt9bcdOg5GXMokzTjJ5SA==",
+ "version": "18.2.18",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.18.tgz",
+ "integrity": "sha512-da4NTSeBv/P34xoZPhtcLkmZuJ+oYaCxHmyHzwaDQo9RQPBeXV+06gEk2FpqEcsX9XrnNLvRpVh6bdavDSjtiQ==",
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
+ "node_modules/@types/react-dom": {
+ "version": "18.2.7",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.7.tgz",
+ "integrity": "sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==",
+ "dependencies": {
+ "@types/react": "*"
+ }
+ },
+ "node_modules/@types/react-highlight-words": {
+ "version": "0.16.4",
+ "resolved": "https://registry.npmjs.org/@types/react-highlight-words/-/react-highlight-words-0.16.4.tgz",
+ "integrity": "sha512-KITBX3xzheQLu2s3bUgLmRE7ekmhc52zRjRTwkKayQARh30L4fjEGzGm7ULK9TuX2LgxWWavZqyQGDGjAHbL3w==",
+ "dependencies": {
+ "@types/react": "*"
+ }
+ },
"node_modules/@types/scheduler": {
"version": "0.16.3",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz",
@@ -2057,6 +2080,12 @@
"dequal": "^2.0.3"
}
},
+ "node_modules/b4a": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
+ "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==",
+ "dev": true
+ },
"node_modules/bail": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
@@ -2071,6 +2100,26 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
"node_modules/big-integer": {
"version": "1.6.51",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
@@ -2096,6 +2145,17 @@
"node": ">=8"
}
},
+ "node_modules/bl": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
+ "dev": true,
+ "dependencies": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ }
+ },
"node_modules/bplist-parser": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",
@@ -2159,6 +2219,30 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
+ "node_modules/buffer": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "dependencies": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@@ -2350,6 +2434,12 @@
"node": ">= 6"
}
},
+ "node_modules/chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "dev": true
+ },
"node_modules/chrome-trace-event": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz",
@@ -2372,6 +2462,19 @@
"node": ">=6"
}
},
+ "node_modules/color": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
+ "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^2.0.1",
+ "color-string": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=12.5.0"
+ }
+ },
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -2388,6 +2491,16 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
+ "node_modules/color-string": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
+ "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "^1.0.0",
+ "simple-swizzle": "^0.2.2"
+ }
+ },
"node_modules/comma-separated-tokens": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
@@ -2504,6 +2617,30 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/decompress-response": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
+ "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
+ "dev": true,
+ "dependencies": {
+ "mimic-response": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
"node_modules/deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@@ -2580,6 +2717,15 @@
"node": ">=6"
}
},
+ "node_modules/detect-libc": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
+ "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/didyoumean": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
@@ -2641,6 +2787,24 @@
"node": ">= 4"
}
},
+ "node_modules/encoding": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
+ "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
+ "devOptional": true,
+ "dependencies": {
+ "iconv-lite": "^0.6.2"
+ }
+ },
+ "node_modules/end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "dev": true,
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
"node_modules/enhanced-resolve": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz",
@@ -3378,6 +3542,15 @@
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
+ "node_modules/expand-template": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
+ "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/ext": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz",
@@ -3401,6 +3574,12 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
+ "node_modules/fast-fifo": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
+ "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
+ "dev": true
+ },
"node_modules/fast-glob": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz",
@@ -3581,6 +3760,12 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
},
+ "node_modules/fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "dev": true
+ },
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -3686,6 +3871,12 @@
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
+ "node_modules/github-from-package": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
+ "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
+ "dev": true
+ },
"node_modules/glob": {
"version": "7.1.7",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
@@ -3948,6 +4139,38 @@
"node": ">=14.18.0"
}
},
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "devOptional": true,
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
"node_modules/ignore": {
"version": "5.2.4",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
@@ -4001,6 +4224,12 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
+ "node_modules/ini": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
+ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
+ "dev": true
+ },
"node_modules/inline-style-parser": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz",
@@ -4056,6 +4285,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-arrayish": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
+ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==",
+ "dev": true
+ },
"node_modules/is-bigint": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz",
@@ -5782,6 +6017,18 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/mimic-response": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
+ "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -5812,6 +6059,12 @@
"mkdirp": "bin/cmd.js"
}
},
+ "node_modules/mkdirp-classic": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
+ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
+ "dev": true
+ },
"node_modules/mri": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
@@ -5852,6 +6105,12 @@
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
+ "node_modules/napi-build-utils": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
+ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
+ "dev": true
+ },
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -5952,6 +6211,24 @@
"node": "^10 || ^12 || >=14"
}
},
+ "node_modules/node-abi": {
+ "version": "3.47.0",
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz",
+ "integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==",
+ "dev": true,
+ "dependencies": {
+ "semver": "^7.3.5"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/node-addon-api": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz",
+ "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
+ "dev": true
+ },
"node_modules/node-fetch": {
"version": "2.6.13",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz",
@@ -6485,6 +6762,60 @@
"fflate": "^0.4.1"
}
},
+ "node_modules/prebuild-install": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
+ "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
+ "dev": true,
+ "dependencies": {
+ "detect-libc": "^2.0.0",
+ "expand-template": "^2.0.3",
+ "github-from-package": "0.0.0",
+ "minimist": "^1.2.3",
+ "mkdirp-classic": "^0.5.3",
+ "napi-build-utils": "^1.0.1",
+ "node-abi": "^3.3.0",
+ "pump": "^3.0.0",
+ "rc": "^1.2.7",
+ "simple-get": "^4.0.0",
+ "tar-fs": "^2.0.0",
+ "tunnel-agent": "^0.6.0"
+ },
+ "bin": {
+ "prebuild-install": "bin.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/prebuild-install/node_modules/tar-fs": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
+ "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
+ "dev": true,
+ "dependencies": {
+ "chownr": "^1.1.1",
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^2.1.4"
+ }
+ },
+ "node_modules/prebuild-install/node_modules/tar-stream": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
+ "dev": true,
+ "dependencies": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -6611,6 +6942,16 @@
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
+ "node_modules/pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "dev": true,
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
"node_modules/punycode": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
@@ -6638,6 +6979,12 @@
}
]
},
+ "node_modules/queue-tick": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
+ "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==",
+ "dev": true
+ },
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -6647,6 +6994,30 @@
"safe-buffer": "^5.1.0"
}
},
+ "node_modules/rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "dev": true,
+ "dependencies": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ },
+ "bin": {
+ "rc": "cli.js"
+ }
+ },
+ "node_modules/rc/node_modules/strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/react": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz",
@@ -6696,6 +7067,20 @@
"pify": "^2.3.0"
}
},
+ "node_modules/readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "dev": true,
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@@ -7074,8 +7459,7 @@
"type": "consulting",
"url": "https://feross.org/support"
}
- ],
- "peer": true
+ ]
},
"node_modules/safe-regex-test": {
"version": "1.0.0",
@@ -7091,6 +7475,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "devOptional": true
+ },
"node_modules/scheduler": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz",
@@ -7155,6 +7545,29 @@
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
"integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ=="
},
+ "node_modules/sharp": {
+ "version": "0.32.5",
+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.5.tgz",
+ "integrity": "sha512-0dap3iysgDkNaPOaOL4X/0akdu0ma62GcdC2NBQ+93eqpePdDdr2/LM0sFdDSMmN7yS+odyZtPsb7tx/cYBKnQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "dependencies": {
+ "color": "^4.2.3",
+ "detect-libc": "^2.0.2",
+ "node-addon-api": "^6.1.0",
+ "prebuild-install": "^7.1.1",
+ "semver": "^7.5.4",
+ "simple-get": "^4.0.1",
+ "tar-fs": "^3.0.4",
+ "tunnel-agent": "^0.6.0"
+ },
+ "engines": {
+ "node": ">=14.15.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -7206,6 +7619,26 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
+ "node_modules/simple-concat": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
+ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
"node_modules/simple-functional-loader": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/simple-functional-loader/-/simple-functional-loader-1.2.1.tgz",
@@ -7214,6 +7647,40 @@
"loader-utils": "^2.0.0"
}
},
+ "node_modules/simple-get": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
+ "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "dependencies": {
+ "decompress-response": "^6.0.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ },
+ "node_modules/simple-swizzle": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
+ "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
+ "dev": true,
+ "dependencies": {
+ "is-arrayish": "^0.3.1"
+ }
+ },
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -7294,6 +7761,25 @@
"node": ">=10.0.0"
}
},
+ "node_modules/streamx": {
+ "version": "2.15.1",
+ "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz",
+ "integrity": "sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==",
+ "dev": true,
+ "dependencies": {
+ "fast-fifo": "^1.1.0",
+ "queue-tick": "^1.0.1"
+ }
+ },
+ "node_modules/string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
"node_modules/string.prototype.matchall": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz",
@@ -7568,6 +8054,28 @@
"node": ">=6"
}
},
+ "node_modules/tar-fs": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz",
+ "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==",
+ "dev": true,
+ "dependencies": {
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^3.1.5"
+ }
+ },
+ "node_modules/tar-stream": {
+ "version": "3.1.6",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz",
+ "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==",
+ "dev": true,
+ "dependencies": {
+ "b4a": "^1.6.4",
+ "fast-fifo": "^1.2.0",
+ "streamx": "^2.15.0"
+ }
+ },
"node_modules/terser": {
"version": "5.19.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.19.1.tgz",
@@ -7752,6 +8260,18 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
+ "node_modules/tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/type": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
@@ -7858,8 +8378,6 @@
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
- "dev": true,
- "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -9501,9 +10019,9 @@
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA=="
},
"@types/node": {
- "version": "20.4.2",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz",
- "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw=="
+ "version": "20.4.7",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.7.tgz",
+ "integrity": "sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g=="
},
"@types/phoenix": {
"version": "1.6.0",
@@ -9516,15 +10034,31 @@
"integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w=="
},
"@types/react": {
- "version": "18.2.15",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.15.tgz",
- "integrity": "sha512-oEjE7TQt1fFTFSbf8kkNuc798ahTUzn3Le67/PWjE8MAfYAD/qB7O8hSTcromLFqHCt9bcdOg5GXMokzTjJ5SA==",
+ "version": "18.2.18",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.18.tgz",
+ "integrity": "sha512-da4NTSeBv/P34xoZPhtcLkmZuJ+oYaCxHmyHzwaDQo9RQPBeXV+06gEk2FpqEcsX9XrnNLvRpVh6bdavDSjtiQ==",
"requires": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
+ "@types/react-dom": {
+ "version": "18.2.7",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.7.tgz",
+ "integrity": "sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==",
+ "requires": {
+ "@types/react": "*"
+ }
+ },
+ "@types/react-highlight-words": {
+ "version": "0.16.4",
+ "resolved": "https://registry.npmjs.org/@types/react-highlight-words/-/react-highlight-words-0.16.4.tgz",
+ "integrity": "sha512-KITBX3xzheQLu2s3bUgLmRE7ekmhc52zRjRTwkKayQARh30L4fjEGzGm7ULK9TuX2LgxWWavZqyQGDGjAHbL3w==",
+ "requires": {
+ "@types/react": "*"
+ }
+ },
"@types/scheduler": {
"version": "0.16.3",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz",
@@ -9998,6 +10532,12 @@
"dequal": "^2.0.3"
}
},
+ "b4a": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
+ "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==",
+ "dev": true
+ },
"bail": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
@@ -10008,6 +10548,12 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
+ "base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "dev": true
+ },
"big-integer": {
"version": "1.6.51",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
@@ -10024,6 +10570,17 @@
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA=="
},
+ "bl": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
+ "dev": true,
+ "requires": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ }
+ },
"bplist-parser": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",
@@ -10061,6 +10618,16 @@
"update-browserslist-db": "^1.0.11"
}
},
+ "buffer": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+ "dev": true,
+ "requires": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
"buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@@ -10178,6 +10745,12 @@
}
}
},
+ "chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "dev": true
+ },
"chrome-trace-event": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz",
@@ -10194,6 +10767,16 @@
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
"integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg=="
},
+ "color": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
+ "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1",
+ "color-string": "^1.9.0"
+ }
+ },
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -10207,6 +10790,16 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
+ "color-string": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
+ "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
+ "dev": true,
+ "requires": {
+ "color-name": "^1.0.0",
+ "simple-swizzle": "^0.2.2"
+ }
+ },
"comma-separated-tokens": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
@@ -10292,6 +10885,21 @@
"character-entities": "^2.0.0"
}
},
+ "decompress-response": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
+ "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
+ "dev": true,
+ "requires": {
+ "mimic-response": "^3.1.0"
+ }
+ },
+ "deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "dev": true
+ },
"deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@@ -10341,6 +10949,12 @@
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="
},
+ "detect-libc": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
+ "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
+ "dev": true
+ },
"didyoumean": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
@@ -10390,6 +11004,24 @@
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q=="
},
+ "encoding": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
+ "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
+ "devOptional": true,
+ "requires": {
+ "iconv-lite": "^0.6.2"
+ }
+ },
+ "end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "dev": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
"enhanced-resolve": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz",
@@ -10953,6 +11585,12 @@
"strip-final-newline": "^3.0.0"
}
},
+ "expand-template": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
+ "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
+ "dev": true
+ },
"ext": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz",
@@ -10978,6 +11616,12 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
+ "fast-fifo": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
+ "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
+ "dev": true
+ },
"fast-glob": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz",
@@ -11122,6 +11766,12 @@
}
}
},
+ "fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "dev": true
+ },
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -11193,6 +11843,12 @@
"resolve-pkg-maps": "^1.0.0"
}
},
+ "github-from-package": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
+ "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
+ "dev": true
+ },
"glob": {
"version": "7.1.7",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
@@ -11381,6 +12037,21 @@
"integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==",
"dev": true
},
+ "iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "devOptional": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ }
+ },
+ "ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "dev": true
+ },
"ignore": {
"version": "5.2.4",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
@@ -11422,6 +12093,12 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
+ "ini": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
+ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
+ "dev": true
+ },
"inline-style-parser": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz",
@@ -11463,6 +12140,12 @@
"is-typed-array": "^1.1.10"
}
},
+ "is-arrayish": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
+ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==",
+ "dev": true
+ },
"is-bigint": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz",
@@ -12599,6 +13282,12 @@
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
"dev": true
},
+ "mimic-response": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
+ "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
+ "dev": true
+ },
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -12620,6 +13309,12 @@
"minimist": "^1.2.6"
}
},
+ "mkdirp-classic": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
+ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
+ "dev": true
+ },
"mri": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
@@ -12645,6 +13340,12 @@
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA=="
},
+ "napi-build-utils": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
+ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
+ "dev": true
+ },
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -12704,6 +13405,21 @@
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
"integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="
},
+ "node-abi": {
+ "version": "3.47.0",
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz",
+ "integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==",
+ "dev": true,
+ "requires": {
+ "semver": "^7.3.5"
+ }
+ },
+ "node-addon-api": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz",
+ "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
+ "dev": true
+ },
"node-fetch": {
"version": "2.6.13",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz",
@@ -13042,6 +13758,53 @@
"fflate": "^0.4.1"
}
},
+ "prebuild-install": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz",
+ "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==",
+ "dev": true,
+ "requires": {
+ "detect-libc": "^2.0.0",
+ "expand-template": "^2.0.3",
+ "github-from-package": "0.0.0",
+ "minimist": "^1.2.3",
+ "mkdirp-classic": "^0.5.3",
+ "napi-build-utils": "^1.0.1",
+ "node-abi": "^3.3.0",
+ "pump": "^3.0.0",
+ "rc": "^1.2.7",
+ "simple-get": "^4.0.0",
+ "tar-fs": "^2.0.0",
+ "tunnel-agent": "^0.6.0"
+ },
+ "dependencies": {
+ "tar-fs": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
+ "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
+ "dev": true,
+ "requires": {
+ "chownr": "^1.1.1",
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^2.1.4"
+ }
+ },
+ "tar-stream": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
+ "dev": true,
+ "requires": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ }
+ }
+ }
+ },
"prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -13086,6 +13849,16 @@
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
+ "pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
"punycode": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
@@ -13096,6 +13869,12 @@
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="
},
+ "queue-tick": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
+ "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==",
+ "dev": true
+ },
"randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -13105,6 +13884,26 @@
"safe-buffer": "^5.1.0"
}
},
+ "rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "dev": true,
+ "requires": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ },
+ "dependencies": {
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
+ "dev": true
+ }
+ }
+ },
"react": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz",
@@ -13145,6 +13944,17 @@
"pify": "^2.3.0"
}
},
+ "readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
"readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@@ -13388,8 +14198,7 @@
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "peer": true
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
},
"safe-regex-test": {
"version": "1.0.0",
@@ -13402,6 +14211,12 @@
"is-regex": "^1.1.4"
}
},
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "devOptional": true
+ },
"scheduler": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz",
@@ -13450,6 +14265,22 @@
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
"integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ=="
},
+ "sharp": {
+ "version": "0.32.5",
+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.5.tgz",
+ "integrity": "sha512-0dap3iysgDkNaPOaOL4X/0akdu0ma62GcdC2NBQ+93eqpePdDdr2/LM0sFdDSMmN7yS+odyZtPsb7tx/cYBKnQ==",
+ "dev": true,
+ "requires": {
+ "color": "^4.2.3",
+ "detect-libc": "^2.0.2",
+ "node-addon-api": "^6.1.0",
+ "prebuild-install": "^7.1.1",
+ "semver": "^7.5.4",
+ "simple-get": "^4.0.1",
+ "tar-fs": "^3.0.4",
+ "tunnel-agent": "^0.6.0"
+ }
+ },
"shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -13492,6 +14323,12 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
+ "simple-concat": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
+ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
+ "dev": true
+ },
"simple-functional-loader": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/simple-functional-loader/-/simple-functional-loader-1.2.1.tgz",
@@ -13500,6 +14337,26 @@
"loader-utils": "^2.0.0"
}
},
+ "simple-get": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
+ "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
+ "dev": true,
+ "requires": {
+ "decompress-response": "^6.0.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ },
+ "simple-swizzle": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
+ "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.3.1"
+ }
+ },
"slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -13559,6 +14416,25 @@
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="
},
+ "streamx": {
+ "version": "2.15.1",
+ "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz",
+ "integrity": "sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==",
+ "dev": true,
+ "requires": {
+ "fast-fifo": "^1.1.0",
+ "queue-tick": "^1.0.1"
+ }
+ },
+ "string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
"string.prototype.matchall": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz",
@@ -13746,6 +14622,28 @@
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="
},
+ "tar-fs": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz",
+ "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==",
+ "dev": true,
+ "requires": {
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^3.1.5"
+ }
+ },
+ "tar-stream": {
+ "version": "3.1.6",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz",
+ "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==",
+ "dev": true,
+ "requires": {
+ "b4a": "^1.6.4",
+ "fast-fifo": "^1.2.0",
+ "streamx": "^2.15.0"
+ }
+ },
"terser": {
"version": "5.19.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.19.1.tgz",
@@ -13880,6 +14778,15 @@
}
}
},
+ "tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
"type": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
@@ -13958,9 +14865,7 @@
"typescript": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
- "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
- "dev": true,
- "peer": true
+ "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA=="
},
"unbox-primitive": {
"version": "1.0.2",
diff --git a/apps/docs/package.json b/apps/docs/package.json
index d9dbd276a..d95f1656c 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
- "lint": "next lint"
+ "lint": "next lint",
+ "format": "prettier --write ."
},
"browserslist": "defaults, not ie <= 11",
"dependencies": {
@@ -22,6 +23,10 @@
"@supabase/supabase-auth-helpers": "^1.4.2",
"@supabase/supabase-js": "^2.32.0",
"@tailwindcss/typography": "^0.5.8",
+ "@types/node": "20.4.7",
+ "@types/react": "18.2.18",
+ "@types/react-dom": "18.2.7",
+ "@types/react-highlight-words": "^0.16.4",
"@vercel/analytics": "^1.0.2",
"acorn": "^8.8.1",
"autoprefixer": "^10.4.7",
@@ -46,6 +51,7 @@
"shiki": "^0.11.1",
"simple-functional-loader": "^1.2.1",
"tailwindcss": "^3.3.3",
+ "typescript": "5.1.6",
"unist-util-filter": "^4.0.1",
"unist-util-visit": "^4.1.1",
"usehooks-ts": "^2.9.1",
@@ -54,9 +60,11 @@
"devDependencies": {
"@e2b/sdk": "^0.1.0",
"@nodelib/fs.walk": "^2.0.0",
+ "encoding": "^0.1.13",
"eslint": "8.45.0",
"eslint-config-next": "13.4.12",
"prettier": "^2.8.7",
- "prettier-plugin-tailwindcss": "^0.2.6"
+ "prettier-plugin-tailwindcss": "^0.2.6",
+ "sharp": "^0.32.0"
}
}
diff --git a/apps/docs/prettier.config.js b/apps/docs/prettier.config.js
index 35bb2b2a6..6b16840e2 100644
--- a/apps/docs/prettier.config.js
+++ b/apps/docs/prettier.config.js
@@ -1,5 +1,6 @@
+/** @type {import('prettier').Options} */
module.exports = {
singleQuote: true,
semi: false,
- plugins: [require('prettier-plugin-tailwindcss')],
+ plugins: ['prettier-plugin-tailwindcss'],
}
diff --git a/apps/docs/src/app/layout.tsx b/apps/docs/src/app/layout.tsx
index 938e569fd..067a254e6 100644
--- a/apps/docs/src/app/layout.tsx
+++ b/apps/docs/src/app/layout.tsx
@@ -1,12 +1,12 @@
import glob from 'fast-glob'
-import { Analytics } from '@vercel/analytics/react';
+import { Analytics } from '@vercel/analytics/react'
import { Providers } from '@/app/providers'
import { Layout } from '@/components/Layout'
-
import '@/styles/tailwind.css'
-import { PostHogAnalytics } from '@/utils/usePostHog';
+import { PostHogAnalytics } from '@/utils/usePostHog'
+import { Section } from '@/components/SectionProvider'
export const metadata = {
title: {
@@ -17,13 +17,13 @@ export const metadata = {
export default async function RootLayout({ children }) {
let pages = await glob('**/*.mdx', { cwd: 'src/app' })
- let allSections = await Promise.all(
+ let allSectionsEntries = (await Promise.all(
pages.map(async (filename) => [
'/' + filename.replace(/(^|\/)page\.mdx$/, ''),
(await import(`./${filename}`)).sections,
])
- )
- allSections = Object.fromEntries(allSections)
+ )) as Array<[string, Array<Section>]>
+ let allSections = Object.fromEntries(allSectionsEntries)
return (
<html lang="en" className="h-full" suppressHydrationWarning>
diff --git a/apps/docs/src/app/providers.tsx b/apps/docs/src/app/providers.tsx
index 81b1c12f2..2e88b235f 100644
--- a/apps/docs/src/app/providers.tsx
+++ b/apps/docs/src/app/providers.tsx
@@ -2,8 +2,8 @@
import { useEffect } from 'react'
import { ThemeProvider, useTheme } from 'next-themes'
-import { CustomUserContextProvider } from '@/utils/useUser';
-import { PostHogProvider } from '@/utils/usePostHog';
+import { CustomUserContextProvider } from '@/utils/useUser'
+import { PostHogProvider } from '@/utils/usePostHog'
function ThemeWatcher() {
let { resolvedTheme, setTheme } = useTheme()
@@ -32,13 +32,15 @@ function ThemeWatcher() {
export function Providers({ children }) {
return (
// Make the dark theme the default theme.
- <ThemeProvider attribute="class" disableTransitionOnChange forcedTheme="dark">
+ <ThemeProvider
+ attribute="class"
+ disableTransitionOnChange
+ forcedTheme="dark"
+ >
<ThemeWatcher />
- <CustomUserContextProvider>
- <PostHogProvider>
- {children}
- </PostHogProvider>
- </CustomUserContextProvider>
+ <CustomUserContextProvider>
+ <PostHogProvider>{children}</PostHogProvider>
+ </CustomUserContextProvider>
</ThemeProvider>
)
}
diff --git a/apps/docs/src/code/js/quickstart.js b/apps/docs/src/code/js/quickstart.js
index 72dcdfb8f..21e47cfc3 100644
--- a/apps/docs/src/code/js/quickstart.js
+++ b/apps/docs/src/code/js/quickstart.js
@@ -5,4 +5,4 @@ import { Session } from '@e2b/sdk'
// We're working on custom environments.
const s = await Session.create({
id: 'Nodejs',
-})
\ No newline at end of file
+})
diff --git a/apps/docs/src/code/ts/quickstart.ts b/apps/docs/src/code/ts/quickstart.ts
index 72dcdfb8f..21e47cfc3 100644
--- a/apps/docs/src/code/ts/quickstart.ts
+++ b/apps/docs/src/code/ts/quickstart.ts
@@ -5,4 +5,4 @@ import { Session } from '@e2b/sdk'
// We're working on custom environments.
const s = await Session.create({
id: 'Nodejs',
-})
\ No newline at end of file
+})
diff --git a/apps/docs/src/code/ts/tsconfig.json b/apps/docs/src/code/ts/tsconfig.json
index 7f2f9e445..0c4fd4969 100644
--- a/apps/docs/src/code/ts/tsconfig.json
+++ b/apps/docs/src/code/ts/tsconfig.json
@@ -11,7 +11,7 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
- "target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
+ "target": "es2017" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@@ -25,7 +25,7 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
- "module": "esnext", /* Specify what module code is generated. */
+ "module": "esnext" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "nodenext",
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
@@ -78,12 +78,12 @@
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
/* Type Checking */
- "strict": true, /* Enable all strict type-checking options. */
+ "strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
@@ -105,6 +105,6 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
diff --git a/apps/docs/src/components/Auth.tsx b/apps/docs/src/components/Auth.tsx
index 5f0908254..b273681f8 100644
--- a/apps/docs/src/components/Auth.tsx
+++ b/apps/docs/src/components/Auth.tsx
@@ -1,11 +1,11 @@
-import { Button } from '@/components/Button';
+import { Button } from '@/components/Button'
import { createClientComponentClient } from '@supabase/auth-helpers-nextjs'
-import { useRouter } from 'next/navigation';
-import { useApiKey, useUser } from '@/utils/useUser';
+import { useRouter } from 'next/navigation'
+import { useApiKey, useUser } from '@/utils/useUser'
import { LogOutIcon } from 'lucide-react'
-import { CopyButton } from '@/components/CopyButton';
-import clsx from 'clsx';
-import { HeaderSeparator } from '@/components/HeaderUtils';
+import { CopyButton } from '@/components/CopyButton'
+import clsx from 'clsx'
+import { HeaderSeparator } from '@/components/HeaderUtils'
import { usePostHog } from 'posthog-js/react'
export const Auth = function () {
@@ -16,12 +16,13 @@ export const Auth = function () {
const supabase = createClientComponentClient()
async function signInWithGitHub() {
- await supabase.auth.signInWithOAuth({ // redirect to GitHub
+ await supabase.auth.signInWithOAuth({
+ // redirect to GitHub
provider: 'github',
options: {
redirectTo: window.location.href,
scopes: 'email',
- }
+ },
})
}
@@ -31,53 +32,61 @@ export const Auth = function () {
router.push('/')
window.location.reload()
}
-
- if (error) return <div className="flex flex-row items-center gap-4">
- <span className="text-red-500 text-sm" title={error?.message}>
- Something went wrong
- </span>
- {/* @ts-ignore */}
- <Button onClick={() => signInWithGitHub()}>Login</Button>
- </div>
- if (isLoading) return <div className="animate-pulse flex">
- <div
- title="Loading..."
- className="w-40 h-2 bg-slate-500 rounded"
- ></div>
- </div>
+ if (error)
+ return (
+ <div className="flex flex-row items-center gap-4">
+ <span className="text-sm text-red-500" title={error?.message}>
+ Something went wrong
+ </span>
+ {/* @ts-ignore */}
+ <Button onClick={() => signInWithGitHub()}>Login</Button>
+ </div>
+ )
- return (<>
+ if (isLoading)
+ return (
+ <div className="flex animate-pulse">
+ <div title="Loading..." className="h-2 w-40 rounded bg-slate-500"></div>
+ </div>
+ )
+
+ return (
+ <>
{user ? (
- <div className="flex flex-col min-[540px]:flex-row items-center gap-4">
+ <div className="flex flex-col items-center gap-4 min-[540px]:flex-row">
<div
className="
- flex flex-row gap-2
- text-xs
- group relative
+ group relative flex
+ flex-row
+ gap-2 text-xs
"
>
- <span className="group-hover:opacity-25 text-zinc-400 whitespace-nowrap">API key</span>
- <span className="group-hover:opacity-25 text-yellow-400 whitespace-nowrap font-mono">{obfuscateKey(apiKey)}</span>
+ <span className="whitespace-nowrap text-zinc-400 group-hover:opacity-25">
+ API key
+ </span>
+ <span className="whitespace-nowrap font-mono text-yellow-400 group-hover:opacity-25">
+ {obfuscateKey(apiKey)}
+ </span>
<span className="absolute inset-0">
<CopyButton
code={apiKey}
- onAfterCopy={() =>
- posthog?.capture('copied API key')
- }
+ onAfterCopy={() => posthog?.capture('copied API key')}
customPositionClassNames={clsx(
- "top-[-2px] bottom-[2px]", /* nudge 2px up*/
- "left-[-6px] right-[-6px]", /* widen a little to fit nicely */
- "min-h-[28px]"
+ 'top-[-2px] bottom-[2px]' /* nudge 2px up*/,
+ 'left-[-6px] right-[-6px]' /* widen a little to fit nicely */,
+ 'min-h-[28px]'
)}
/>
</span>
</div>
<HeaderSeparator />
<div className="flex items-center gap-2">
- <div className="
- text-xs font-bold whitespace-nowrap
- ">
+ <div
+ className="
+ whitespace-nowrap text-xs font-bold
+ "
+ >
{user.email}
{/* TODO: Add dropdown with more options: Dashboard, API keys, ... */}
</div>
@@ -87,14 +96,20 @@ export const Auth = function () {
title="Sign out"
onClick={() => signOut()}
>
- <LogOutIcon className="w-5 h-5" />
+ <LogOutIcon className="h-5 w-5" />
</Button>
</div>
</div>
) : (
<div className="flex items-center gap-3">
{/* @ts-ignore */}
- <Button onClick={() => signInWithGitHub()} variant="textTernary" className="text-xs">Login to get your API key</Button>
+ <Button
+ onClick={() => signInWithGitHub()}
+ variant="textTernary"
+ className="text-xs"
+ >
+ Login to get your API key
+ </Button>
{/* @ts-ignore */}
<Button onClick={() => signInWithGitHub()}>Login</Button>
</div>
@@ -109,5 +124,7 @@ export const Auth = function () {
* @returns {string}
*/
function obfuscateKey(apiKey) {
- return apiKey.substring(0, 7) + '*'.repeat(4) + apiKey.substring(apiKey.length - 3)
+ return (
+ apiKey.substring(0, 7) + '*'.repeat(4) + apiKey.substring(apiKey.length - 3)
+ )
}
diff --git a/apps/docs/src/components/Button.tsx b/apps/docs/src/components/Button.tsx
index 68dc8834f..a908aeb80 100644
--- a/apps/docs/src/components/Button.tsx
+++ b/apps/docs/src/components/Button.tsx
@@ -1,7 +1,7 @@
import Link from 'next/link'
import clsx from 'clsx'
-function ArrowIcon(props) {
+function ArrowIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
<path
@@ -15,16 +15,32 @@ function ArrowIcon(props) {
}
const variantStyles = {
- primary: 'rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-1 dark:ring-inset dark:ring-emerald-400/20 dark:hover:bg-emerald-400/10 dark:hover:text-emerald-300 dark:hover:ring-emerald-300',
- secondary: 'rounded-full bg-zinc-100 py-1 px-3 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800/40 dark:text-zinc-400 dark:ring-1 dark:ring-inset dark:ring-zinc-800 dark:hover:bg-zinc-800 dark:hover:text-zinc-300',
- ternary: 'rounded-full bg-yellow-100 py-1 px-3 text-yellow-900 hover:bg-yellow-200 dark:bg-yellow-800/40 dark:text-yellow-400 dark:ring-1 dark:ring-inset dark:ring-yellow-800 dark:hover:bg-yellow-800 dark:hover:text-yellow-300',
- filled: 'rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-500 dark:text-white dark:hover:bg-emerald-400',
- outline: 'rounded-full py-1 px-3 text-zinc-700 ring-1 ring-inset ring-zinc-900/10 hover:bg-zinc-900/2.5 hover:text-zinc-900 dark:text-zinc-400 dark:ring-white/10 dark:hover:bg-white/5 dark:hover:text-white',
+ primary:
+ 'rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-1 dark:ring-inset dark:ring-emerald-400/20 dark:hover:bg-emerald-400/10 dark:hover:text-emerald-300 dark:hover:ring-emerald-300',
+ secondary:
+ 'rounded-full bg-zinc-100 py-1 px-3 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800/40 dark:text-zinc-400 dark:ring-1 dark:ring-inset dark:ring-zinc-800 dark:hover:bg-zinc-800 dark:hover:text-zinc-300',
+ ternary:
+ 'rounded-full bg-yellow-100 py-1 px-3 text-yellow-900 hover:bg-yellow-200 dark:bg-yellow-800/40 dark:text-yellow-400 dark:ring-1 dark:ring-inset dark:ring-yellow-800 dark:hover:bg-yellow-800 dark:hover:text-yellow-300',
+ filled:
+ 'rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-500 dark:text-white dark:hover:bg-emerald-400',
+ outline:
+ 'rounded-full py-1 px-3 text-zinc-700 ring-1 ring-inset ring-zinc-900/10 hover:bg-zinc-900/2.5 hover:text-zinc-900 dark:text-zinc-400 dark:ring-white/10 dark:hover:bg-white/5 dark:hover:text-white',
text: 'text-emerald-500 hover:text-emerald-600 dark:text-emerald-400 dark:hover:text-emerald-500',
- textSubtle: 'text-zinc-500 hover:text-zinc-600 dark:text-zinc-400 dark:hover:text-zinc-500', // same as text, but gray-ish
- textTernary: 'text-yellow-500 hover:text-yellow-600 dark:text-yellow-400 dark:hover:text-yellow-500', // same as text, but gray-ish
+ textSubtle:
+ 'text-zinc-500 hover:text-zinc-600 dark:text-zinc-400 dark:hover:text-zinc-500', // same as text, but gray-ish
+ textTernary:
+ 'text-yellow-500 hover:text-yellow-600 dark:text-yellow-400 dark:hover:text-yellow-500', // same as text, but gray-ish
}
+type ButtonProps = {
+ variant?: keyof typeof variantStyles
+ disabled?: boolean
+ arrow?: 'left' | 'right'
+} & (
+ | React.ComponentPropsWithoutRef<typeof Link>
+ | (React.ComponentPropsWithoutRef<'button'> & { href?: undefined })
+)
+
export function Button({
variant = 'primary',
disabled = false,
@@ -32,9 +48,7 @@ export function Button({
children,
arrow,
...props
-}) {
- let Component = props.href ? Link : 'button'
-
+}: ButtonProps) {
className = clsx(
'inline-flex gap-0.5 justify-center overflow-hidden text-sm font-medium transition',
variantStyles[variant],
@@ -53,12 +67,27 @@ export function Button({
/>
)
- return (
- // @ts-ignore
- <Component className={className} {...props}>
+ let inner = (
+ <>
{arrow === 'left' && arrowIcon}
{children}
{arrow === 'right' && arrowIcon}
- </Component>
+ </>
+ )
+
+ if (typeof props.href === 'undefined') {
+ return (
+ // @ts-ignore
+ <button className={className} {...props}>
+ {inner}
+ </button>
+ )
+ }
+
+ return (
+ // @ts-ignore
+ <Link className={className} {...props}>
+ {inner}
+ </Link>
)
}
diff --git a/apps/docs/src/components/ButtonLoginToken.tsx b/apps/docs/src/components/ButtonLoginToken.tsx
index 072aa980e..bdaa770bd 100644
--- a/apps/docs/src/components/ButtonLoginToken.tsx
+++ b/apps/docs/src/components/ButtonLoginToken.tsx
@@ -1,34 +1,36 @@
'use client'
-import { Button } from '@/components/Button';
-import { createClientComponentClient } from '@supabase/auth-helpers-nextjs';
-import { useUser } from '@/utils/useUser';
+import { Button } from '@/components/Button'
+import { createClientComponentClient } from '@supabase/auth-helpers-nextjs'
+import { useUser } from '@/utils/useUser'
export function ButtonLoginToken() {
const supabase = createClientComponentClient()
const { user, isLoading } = useUser()
-
+
async function signInWithGitHub() {
- await supabase.auth.signInWithOAuth({ // redirect to GitHub
+ await supabase.auth.signInWithOAuth({
+ // redirect to GitHub
provider: 'github',
options: {
redirectTo: window.location.href,
scopes: 'email',
- }
+ },
})
}
-
+
let extraClassName = 'duration-300'
if (isLoading) extraClassName += ' opacity-0 pointer-events-none'
if (user) return null
// @ts-ignore
- return <Button
- onClick={() => signInWithGitHub()}
- variant="textTernary"
- className={extraClassName}
- >
- Login to get your API key
- </Button>
-
+ return (
+ <Button
+ onClick={() => signInWithGitHub()}
+ variant="textTernary"
+ className={extraClassName}
+ >
+ Login to get your API key
+ </Button>
+ )
}
diff --git a/apps/docs/src/components/Code.tsx b/apps/docs/src/components/Code.tsx
index d833aa9a2..199fd4ef8 100644
--- a/apps/docs/src/components/Code.tsx
+++ b/apps/docs/src/components/Code.tsx
@@ -1,15 +1,23 @@
'use client'
-import { Children, createContext, useContext, useEffect, useRef, useState, } from 'react'
+import {
+ Children,
+ createContext,
+ isValidElement,
+ useContext,
+ useEffect,
+ useRef,
+ useState,
+} from 'react'
import { Tab } from '@headlessui/react'
import clsx from 'clsx'
import { create } from 'zustand'
import { Tag } from '@/components/Tag'
-import { CopyButton } from '@/components/CopyButton';
-import { useApiKey } from '@/utils/useUser';
+import { CopyButton } from '@/components/CopyButton'
+import { useApiKey } from '@/utils/useUser'
-const languageNames = {
+const languageNames: Record<string, string> = {
js: 'JavaScript',
ts: 'TypeScript',
javascript: 'JavaScript',
@@ -20,8 +28,20 @@ const languageNames = {
go: 'Go',
}
-function getPanelTitle({ title, language }) {
- return title ?? languageNames[language] ?? 'Code'
+function getPanelTitle({
+ title,
+ language,
+}: {
+ title?: string
+ language?: string
+}) {
+ if (title) {
+ return title
+ }
+ if (language && language in languageNames) {
+ return languageNames[language]
+ }
+ return 'Code'
}
function CodePanelHeader({ tag, label }) {
@@ -46,24 +66,51 @@ function CodePanelHeader({ tag, label }) {
)
}
-function CodePanel({ tag, label, code, children }) {
+function CodePanel({
+ children,
+ tag,
+ label,
+ code,
+}: {
+ children: React.ReactNode
+ tag?: string
+ label?: string
+ code?: string
+}) {
let child = Children.only(children)
+ if (isValidElement(child)) {
+ tag = child.props.tag ?? tag
+ label = child.props.label ?? label
+ code = child.props.code ?? code
+ }
+
+ if (!code) {
+ throw new Error(
+ '`CodePanel` requires a `code` prop, or a child with a `code` prop.'
+ )
+ }
+
return (
<div className="group dark:bg-white/2.5">
- <CodePanelHeader
- tag={child.props.tag ?? tag}
- label={child.props.label ?? label}
- />
+ <CodePanelHeader tag={tag} label={label} />
<div className="relative">
<pre className="overflow-x-auto p-4 text-xs text-white">{children}</pre>
- <CopyButton code={child.props.code ?? code} />
+ <CopyButton code={code} />
</div>
</div>
)
}
-function CodeGroupHeader({ title, children, selectedIndex }) {
+function CodeGroupHeader({
+ title,
+ children,
+ selectedIndex,
+}: {
+ title: string
+ children: React.ReactNode
+ selectedIndex: number
+}) {
let hasTabs = Children.count(children) > 1
if (!title && !hasTabs) {
@@ -88,7 +135,7 @@ function CodeGroupHeader({ title, children, selectedIndex }) {
: 'border-transparent text-zinc-400 hover:text-zinc-300'
)}
>
- {getPanelTitle(child.props)}
+ {getPanelTitle(isValidElement(child) ? child.props : {})}
</Tab>
))}
</Tab.List>
@@ -97,7 +144,10 @@ function CodeGroupHeader({ title, children, selectedIndex }) {
)
}
-function CodeGroupPanels({ children, ...props }) {
+function CodeGroupPanels({
+ children,
+ ...props
+}: React.ComponentPropsWithoutRef<typeof CodePanel>) {
let hasTabs = Children.count(children) > 1
if (hasTabs) {
@@ -105,7 +155,6 @@ function CodeGroupPanels({ children, ...props }) {
<Tab.Panels>
{Children.map(children, (child) => (
<Tab.Panel>
- {/* @ts-ignore */}
<CodePanel {...props}>{child}</CodePanel>
</Tab.Panel>
))}
@@ -113,39 +162,45 @@ function CodeGroupPanels({ children, ...props }) {
)
}
- // @ts-ignore
return <CodePanel {...props}>{children}</CodePanel>
}
function usePreventLayoutShift() {
- let positionRef = useRef()
- let rafRef = useRef()
+ let positionRef = useRef<HTMLElement>(null)
+ let rafRef = useRef<number>()
useEffect(() => {
return () => {
- window.cancelAnimationFrame(rafRef.current)
+ if (typeof rafRef.current !== 'undefined') {
+ window.cancelAnimationFrame(rafRef.current)
+ }
}
}, [])
return {
positionRef,
- preventLayoutShift(callback) {
- // @ts-ignore
+ preventLayoutShift(callback: () => void) {
+ if (!positionRef.current) {
+ return
+ }
+
let initialTop = positionRef.current.getBoundingClientRect().top
callback()
- // @ts-ignore
rafRef.current = window.requestAnimationFrame(() => {
- // @ts-ignore
- let newTop = positionRef.current.getBoundingClientRect().top
+ let newTop =
+ positionRef.current?.getBoundingClientRect().top ?? initialTop
window.scrollBy(0, newTop - initialTop)
})
},
}
}
-const usePreferredLanguageStore = create((set) => ({
+const usePreferredLanguageStore = create<{
+ preferredLanguages: Array<string>
+ addPreferredLanguage: (language: string) => void
+}>()((set) => ({
preferredLanguages: [],
addPreferredLanguage: (language) =>
set((state) => ({
@@ -158,8 +213,7 @@ const usePreferredLanguageStore = create((set) => ({
})),
}))
-function useTabGroupProps(availableLanguages) {
- // @ts-ignore
+function useTabGroupProps(availableLanguages: Array<string>) {
let { preferredLanguages, addPreferredLanguage } = usePreferredLanguageStore()
let [selectedIndex, setSelectedIndex] = useState(0)
let activeLanguage = [...availableLanguages].sort(
@@ -174,10 +228,10 @@ function useTabGroupProps(availableLanguages) {
let { positionRef, preventLayoutShift } = usePreventLayoutShift()
return {
- as: 'div',
+ as: 'div' as const,
ref: positionRef,
selectedIndex,
- onChange: (newSelectedIndex) => {
+ onChange: (newSelectedIndex: number) => {
preventLayoutShift(() =>
addPreferredLanguage(availableLanguages[newSelectedIndex])
)
@@ -187,55 +241,76 @@ function useTabGroupProps(availableLanguages) {
const CodeGroupContext = createContext(false)
-export function CodeGroup({ children, title, ...props }) {
- let languages = Children.map(children, (child) => getPanelTitle(child.props))
+export function CodeGroup({
+ children,
+ title,
+ ...props
+}: React.ComponentPropsWithoutRef<typeof CodeGroupPanels> & { title: string }) {
+ let languages =
+ Children.map(children, (child) =>
+ getPanelTitle(isValidElement(child) ? child.props : {})
+ ) ?? []
let tabGroupProps = useTabGroupProps(languages)
let hasTabs = Children.count(children) > 1
- let Container = hasTabs ? Tab.Group : 'div'
- let containerProps = hasTabs ? tabGroupProps : {}
- let headerProps = hasTabs
- ? { selectedIndex: tabGroupProps.selectedIndex }
- : {}
+
+ let containerClassName =
+ 'not-prose my-6 overflow-hidden rounded-2xl bg-zinc-900 shadow-md dark:ring-1 dark:ring-white/10'
+ let header = (
+ <CodeGroupHeader title={title} selectedIndex={tabGroupProps.selectedIndex}>
+ {children}
+ </CodeGroupHeader>
+ )
+ let panels = <CodeGroupPanels {...props}>{children}</CodeGroupPanels>
return (
<CodeGroupContext.Provider value={true}>
- <Container
- {...containerProps}
- // @ts-ignore
- className="not-prose my-6 overflow-hidden rounded-2xl bg-zinc-900 shadow-md dark:ring-1 dark:ring-white/10"
- >
- {/* @ts-ignore */}
- <CodeGroupHeader title={title} {...headerProps}>
- {children}
- </CodeGroupHeader>
- <CodeGroupPanels {...props}>{children}</CodeGroupPanels>
- </Container>
+ {hasTabs ? (
+ <Tab.Group {...tabGroupProps} className={containerClassName}>
+ {header}
+ {panels}
+ </Tab.Group>
+ ) : (
+ <div className={containerClassName}>
+ {header}
+ {panels}
+ </div>
+ )}
</CodeGroupContext.Provider>
)
}
-export function Code({ children, ...props }) {
- let isGrouped = useContext(CodeGroupContext)
-
+export function Code({
+ children,
+ ...props
+}: React.ComponentPropsWithoutRef<'code'>) {
/* <DYNAMIC-API-REPLACEMENT> */
// let apiKey = useApiKey()
// if (children.replace && apiKey) children = children.replace(`{{API_KEY}}`, `${apiKey}`)
/* </DYNAMIC-API-REPLACEMENT> */
+ let isGrouped = useContext(CodeGroupContext)
+
if (isGrouped) {
+ if (typeof children !== 'string') {
+ throw new Error(
+ '`Code` children must be a string when nested inside a `CodeGroup`.'
+ )
+ }
return <code {...props} dangerouslySetInnerHTML={{ __html: children }} />
}
return <code {...props}>{children}</code>
}
-export function Pre({ children, ...props }) {
+export function Pre({
+ children,
+ ...props
+}: React.ComponentPropsWithoutRef<typeof CodeGroup>) {
let isGrouped = useContext(CodeGroupContext)
if (isGrouped) {
return children
}
- // @ts-ignore
return <CodeGroup {...props}>{children}</CodeGroup>
}
diff --git a/apps/docs/src/components/CopyButton.tsx b/apps/docs/src/components/CopyButton.tsx
index db303de7f..fa387db85 100644
--- a/apps/docs/src/components/CopyButton.tsx
+++ b/apps/docs/src/components/CopyButton.tsx
@@ -1,5 +1,5 @@
-import { useEffect, useRef, useState } from 'react';
-import clsx from 'clsx';
+import { useEffect, useRef, useState } from 'react'
+import clsx from 'clsx'
function ClipboardIcon(props) {
return (
@@ -17,10 +17,10 @@ function ClipboardIcon(props) {
)
}
-export function CopyButton({
- code,
- customPositionClassNames = 'right-4 top-3.5', // default from TailwindUI, works great with code blocks
- onAfterCopy = () => {}
+export function CopyButton({
+ code,
+ customPositionClassNames = 'right-4 top-3.5', // default from TailwindUI, works great with code blocks
+ onAfterCopy = () => {},
}) {
let buttonRef = useRef()
let [copyCount, setCopyCount] = useState(0)
@@ -29,7 +29,7 @@ export function CopyButton({
useEffect(() => {
if (copyCount > 0) {
let timeout = setTimeout(() => {
- setCopyCount(0);
+ setCopyCount(0)
// @ts-ignore
buttonRef.current?.blur()
}, 1000)
diff --git a/apps/docs/src/components/DialogAnimated.tsx b/apps/docs/src/components/DialogAnimated.tsx
index 80f10d8a9..f0bdd1d00 100644
--- a/apps/docs/src/components/DialogAnimated.tsx
+++ b/apps/docs/src/components/DialogAnimated.tsx
@@ -1,6 +1,6 @@
-import { Fragment } from 'react';
-import { Dialog, Transition } from '@headlessui/react';
-import clsx from 'clsx';
+import { Fragment } from 'react'
+import { Dialog, Transition } from '@headlessui/react'
+import clsx from 'clsx'
export function DialogAnimated({
open,
@@ -11,44 +11,40 @@ export function DialogAnimated({
rootProps = {},
children,
}) {
- return <Transition.Root
- show={open}
- as={as}
- afterLeave={afterLeave}
- >
- <Dialog
- onClose={setOpen}
- className={clsx('fixed inset-0 z-50', className)}
- >
- <Transition.Child
- as={Fragment}
- enter="ease-out duration-300"
- enterFrom="opacity-0"
- enterTo="opacity-100"
- leave="ease-in duration-200"
- leaveFrom="opacity-100"
- leaveTo="opacity-0"
- >
- <div className="fixed inset-0 bg-zinc-400/25 backdrop-blur-sm dark:bg-black/40" />
- </Transition.Child>
+ return (
+ <Transition.Root show={open} as={as} afterLeave={afterLeave}>
+ <Dialog
+ onClose={setOpen}
+ className={clsx('fixed inset-0 z-50', className)}
+ >
+ <Transition.Child
+ as={Fragment}
+ enter="ease-out duration-300"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ >
+ <div className="fixed inset-0 bg-zinc-400/25 backdrop-blur-sm dark:bg-black/40" />
+ </Transition.Child>
- <div className="fixed inset-0 overflow-y-auto px-4 py-4 sm:px-6 sm:py-20 md:py-32 lg:px-8 lg:py-[15vh]">
- <Transition.Child
- as={Fragment}
- enter="ease-out duration-300"
- enterFrom="opacity-0 scale-95"
- enterTo="opacity-100 scale-100"
- leave="ease-in duration-200"
- leaveFrom="opacity-100 scale-100"
- leaveTo="opacity-0 scale-95"
- >
- <Dialog.Panel className="mx-auto transform-gpu overflow-hidden rounded-lg bg-zinc-50 shadow-xl ring-1 ring-zinc-900/7.5 dark:bg-zinc-900 dark:ring-zinc-800 sm:max-w-xl">
- <div {...rootProps}>
- {children}
- </div>
- </Dialog.Panel>
- </Transition.Child>
- </div>
- </Dialog>
- </Transition.Root>
+ <div className="fixed inset-0 overflow-y-auto px-4 py-4 sm:px-6 sm:py-20 md:py-32 lg:px-8 lg:py-[15vh]">
+ <Transition.Child
+ as={Fragment}
+ enter="ease-out duration-300"
+ enterFrom="opacity-0 scale-95"
+ enterTo="opacity-100 scale-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100 scale-100"
+ leaveTo="opacity-0 scale-95"
+ >
+ <Dialog.Panel className="mx-auto transform-gpu overflow-hidden rounded-lg bg-zinc-50 shadow-xl ring-1 ring-zinc-900/7.5 dark:bg-zinc-900 dark:ring-zinc-800 sm:max-w-xl">
+ <div {...rootProps}>{children}</div>
+ </Dialog.Panel>
+ </Transition.Child>
+ </div>
+ </Dialog>
+ </Transition.Root>
+ )
}
diff --git a/apps/docs/src/components/Feedback/FeedbackButton.tsx b/apps/docs/src/components/Feedback/FeedbackButton.tsx
index 2b8536d1c..731c19d3c 100644
--- a/apps/docs/src/components/Feedback/FeedbackButton.tsx
+++ b/apps/docs/src/components/Feedback/FeedbackButton.tsx
@@ -1,39 +1,28 @@
-"use client"
+'use client'
-import {
- Check,
- MessageCircle,
-} from 'lucide-react'
-import { Button } from '@/components/Button';
+import { Check, MessageCircle } from 'lucide-react'
+import { Button } from '@/components/Button'
// export interface Props {
// onClick: (e: MouseEvent<HTMLButtonElement>) => void
// isFinished: boolean
// }
-function FeedbackButton({
- onClick,
- isFinished,
- variant,
- className,
-}) {
+function FeedbackButton({ onClick, isFinished, variant, className }) {
return (
// @ts-ignore
- <Button
- onMouseDown={onClick}
- variant={variant}
- className={className}
- >
- {isFinished
- ? <>
+ <Button onMouseDown={onClick} variant={variant} className={className}>
+ {isFinished ? (
+ <>
<Check size={14} className="" />
<span className="text-sm">Thank you!</span>
</>
- : <div className="flex flex-row items-center gap-2">
+ ) : (
+ <div className="flex flex-row items-center gap-2">
<MessageCircle size={14} className="" />
<span className="text-sm">Send feedback to CEO</span>
</div>
- }
+ )}
</Button>
)
}
diff --git a/apps/docs/src/components/Feedback/FeedbackModal.tsx b/apps/docs/src/components/Feedback/FeedbackModal.tsx
index 56af7b7f4..ebb8667c9 100644
--- a/apps/docs/src/components/Feedback/FeedbackModal.tsx
+++ b/apps/docs/src/components/Feedback/FeedbackModal.tsx
@@ -1,4 +1,4 @@
-"use client"
+'use client'
import { Fragment, useRef, useState } from 'react'
import { useOnClickOutside } from 'usehooks-ts'
@@ -6,36 +6,44 @@ import { Send } from 'lucide-react'
import Textarea from '@/components/Textarea'
import SpinnerIcon from '@/components/Spinner'
-import { useUser } from '@/utils/useUser';
-import { usePostHog } from 'posthog-js/react';
-import { DialogAnimated } from '@/components/DialogAnimated';
-import { Button } from '@/components/Button';
-import { usePathname } from 'next/navigation';
+import { usePostHog } from 'posthog-js/react'
+import { DialogAnimated } from '@/components/DialogAnimated'
+import { Button } from '@/components/Button'
+import { usePathname } from 'next/navigation'
function FeedbackModal({ open, setOpen, onSend }) {
- const pathname = usePathname();
+ const pathname = usePathname()
const [feedback, setFeedback] = useState('')
const [isSavingFeedback, setIsSavingFeedback] = useState(false)
const posthog = usePostHog()
const ref = useRef(null)
- useOnClickOutside(ref, () => {setOpen(false)}, 'mousedown')
+ useOnClickOutside(
+ ref,
+ () => {
+ setOpen(false)
+ },
+ 'mousedown'
+ )
async function saveFeedback(ev) {
ev.preventDefault()
// if (!user?.id) return console.error('User is not logged in') // for now, allow feedback from anonymous users
if (!feedback) return console.error('Feedback is empty')
- if (isSavingFeedback) return console.error('Feedback is already being saved')
+ if (isSavingFeedback)
+ return console.error('Feedback is already being saved')
setIsSavingFeedback(true)
// https://app.posthog.com/data-management/actions/49309
- posthog?.capture("survey sent", {
- $survey_id: "018a1df8-ae8d-0000-8925-9a76a5255a29",
- $survey_name: "Docs Feedback",
- $survey_response: `\`${pathname}\`\n${feedback ?? `No feedback provided`}`,
+ posthog?.capture('survey sent', {
+ $survey_id: '018a1df8-ae8d-0000-8925-9a76a5255a29',
+ $survey_name: 'Docs Feedback',
+ $survey_response: `\`${pathname}\`\n${
+ feedback ?? `No feedback provided`
+ }`,
})
-
+
// Cleanup
setIsSavingFeedback(false)
setOpen(false)
@@ -43,46 +51,45 @@ function FeedbackModal({ open, setOpen, onSend }) {
onSend?.()
}
- return <DialogAnimated
- open={open}
- setOpen={setOpen}
- as={Fragment}
- >
- <form
- ref={ref}
- autoCapitalize="off"
- autoCorrect="on"
- autoComplete="off"
- className="
+ return (
+ <DialogAnimated open={open} setOpen={setOpen} as={Fragment}>
+ <form
+ ref={ref}
+ autoCapitalize="off"
+ autoCorrect="on"
+ autoComplete="off"
+ className="
flex flex-col space-y-3
p-4
"
- onSubmit={saveFeedback}
- >
- <Textarea
- value={feedback}
- placeholder="What should we improve?"
- onChange={e => setFeedback(e.target.value)}
- // @ts-ignore
- open={open}
- />
- {/* @ts-ignore */}
- <Button
- onClick={saveFeedback}
- type="submit"
- disabled={isSavingFeedback || feedback.trim() === ''}
- className="flex items-center gap-2 cursor-pointer"
+ onSubmit={saveFeedback}
>
- {isSavingFeedback
+ <Textarea
+ value={feedback}
+ placeholder="What should we improve?"
+ onChange={(e) => setFeedback(e.target.value)}
// @ts-ignore
- ? <SpinnerIcon />
- : <Send size="14px" />
- }
-
- <span className="text-sm">Send</span>
- </Button>
- </form>
- </DialogAnimated>
+ open={open}
+ />
+ {/* @ts-ignore */}
+ <Button
+ onClick={saveFeedback}
+ type="submit"
+ disabled={isSavingFeedback || feedback.trim() === ''}
+ className="flex cursor-pointer items-center gap-2"
+ >
+ {isSavingFeedback ? (
+ // @ts-ignore
+ <SpinnerIcon />
+ ) : (
+ <Send size="14px" />
+ )}
+
+ <span className="text-sm">Send</span>
+ </Button>
+ </form>
+ </DialogAnimated>
+ )
}
export default FeedbackModal
diff --git a/apps/docs/src/components/Feedback/index.tsx b/apps/docs/src/components/Feedback/index.tsx
index 7def9af23..959b2f6e8 100644
--- a/apps/docs/src/components/Feedback/index.tsx
+++ b/apps/docs/src/components/Feedback/index.tsx
@@ -4,11 +4,20 @@ import { useState } from 'react'
import FeedbackButton from './FeedbackButton'
import FeedbackModal from './FeedbackModal'
-import useExpiringState from '@/utils/useExpiringState';
+import useExpiringState from '@/utils/useExpiringState'
-export function Feedback({ className, variant }: { className?: string, variant?: string }) {
+export function Feedback({
+ className,
+ variant,
+}: {
+ className?: string
+ variant?: string
+}) {
const [open, setOpen] = useState(false)
- const [isFinished, setIsFinished] = useExpiringState({ defaultValue: false, timeout: 4000 })
+ const [isFinished, setIsFinished] = useExpiringState({
+ defaultValue: false,
+ timeout: 4000,
+ })
return (
<>
@@ -18,7 +27,7 @@ export function Feedback({ className, variant }: { className?: string, variant?:
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
- setOpen(f => !f)
+ setOpen((f) => !f)
}}
isFinished={isFinished}
/>
@@ -30,4 +39,3 @@ export function Feedback({ className, variant }: { className?: string, variant?:
</>
)
}
-
diff --git a/apps/docs/src/components/Footer.tsx b/apps/docs/src/components/Footer.tsx
index 5458b15d6..101bedf66 100644
--- a/apps/docs/src/components/Footer.tsx
+++ b/apps/docs/src/components/Footer.tsx
@@ -5,14 +5,21 @@ import { usePathname } from 'next/navigation'
import { Button } from '@/components/Button'
import { navigation } from '@/components/Navigation'
-import { TwitterIcon } from '@/components/icons/TwitterIcon';
-import { GitHubIcon } from '@/components/icons/GitHubIcon';
-import { DiscordIcon } from '@/components/icons/DiscordIcon';
+import { TwitterIcon } from '@/components/icons/TwitterIcon'
+import { GitHubIcon } from '@/components/icons/GitHubIcon'
+import { DiscordIcon } from '@/components/icons/DiscordIcon'
-function PageLink({ label, page, previous = false }) {
+function PageLink({
+ label,
+ page,
+ previous = false,
+}: {
+ label: string
+ page: { href: string; title: string }
+ previous?: boolean
+}) {
return (
<>
- {/* @ts-ignore */}
<Button
href={page.href}
aria-label={`${label}: ${page.title}`}
@@ -65,7 +72,15 @@ function PageNavigation() {
)
}
-function SocialLink({ href, icon: Icon, children }) {
+function SocialLink({
+ href,
+ icon: Icon,
+ children,
+}: {
+ href: string
+ icon: React.ComponentType<{ className?: string }>
+ children: React.ReactNode
+}) {
return (
<Link href={href} className="group">
<span className="sr-only">{children}</span>
@@ -78,7 +93,8 @@ function SmallPrint() {
return (
<div className="flex flex-col items-center justify-between gap-5 border-t border-zinc-900/5 pt-8 dark:border-white/5 sm:flex-row">
<p className="text-xs text-zinc-600 dark:text-zinc-400">
- &copy; FoundryLabs, Inc. {new Date().getFullYear()}. All rights reserved.
+ &copy; FoundryLabs, Inc. {new Date().getFullYear()}. All rights
+ reserved.
</p>
<div className="flex gap-4">
<SocialLink href="https://twitter.com/e2b_dev" icon={TwitterIcon}>
diff --git a/apps/docs/src/components/GridPattern.tsx b/apps/docs/src/components/GridPattern.tsx
index d8337656f..520299114 100644
--- a/apps/docs/src/components/GridPattern.tsx
+++ b/apps/docs/src/components/GridPattern.tsx
@@ -1,6 +1,19 @@
import { useId } from 'react'
-export function GridPattern({ width, height, x, y, squares, ...props }) {
+export function GridPattern({
+ width,
+ height,
+ x,
+ y,
+ squares,
+ ...props
+}: React.ComponentPropsWithoutRef<'svg'> & {
+ width: number
+ height: number
+ x: string | number
+ y: string | number
+ squares: Array<[x: number, y: number]>
+}) {
let patternId = useId()
return (
diff --git a/apps/docs/src/components/Header.tsx b/apps/docs/src/components/Header.tsx
index d83bd2a3a..55cadb217 100644
--- a/apps/docs/src/components/Header.tsx
+++ b/apps/docs/src/components/Header.tsx
@@ -2,15 +2,25 @@ import { forwardRef } from 'react'
import Link from 'next/link'
import clsx from 'clsx'
import { motion, useScroll, useTransform } from 'framer-motion'
-import { MobileNavigation, useIsInsideMobileNavigation, useMobileNavigationStore, } from '@/components/MobileNavigation'
+import {
+ MobileNavigation,
+ useIsInsideMobileNavigation,
+ useMobileNavigationStore,
+} from '@/components/MobileNavigation'
import { MobileSearch, Search } from '@/components/Search'
-import { Auth } from '@/components/Auth';
-import { HeaderSeparator } from '@/components/HeaderUtils';
-import { DiscordIcon } from '@/components/icons/DiscordIcon';
-import { TwitterIcon } from '@/components/icons/TwitterIcon';
-import { GitHubIcon } from '@/components/icons/GitHubIcon';
+import { Auth } from '@/components/Auth'
+import { HeaderSeparator } from '@/components/HeaderUtils'
+import { DiscordIcon } from '@/components/icons/DiscordIcon'
+import { TwitterIcon } from '@/components/icons/TwitterIcon'
+import { GitHubIcon } from '@/components/icons/GitHubIcon'
-function TopLevelNavItem({ href, children }) {
+function TopLevelNavItem({
+ href,
+ children,
+}: {
+ href: string
+ children: React.ReactNode
+}) {
return (
<li>
<Link
@@ -41,22 +51,23 @@ export const Header = forwardRef(function Header({ className }, ref) {
className,
'fixed inset-x-0 top-0 z-50 flex h-14 items-center justify-between gap-12 px-4 transition sm:px-6 lg:left-72 lg:z-30 lg:px-8 xl:left-80',
!isInsideMobileNavigation &&
- 'backdrop-blur-sm dark:backdrop-blur lg:left-72 xl:left-80',
+ 'backdrop-blur-sm dark:backdrop-blur lg:left-72 xl:left-80',
isInsideMobileNavigation
? 'bg-white dark:bg-zinc-900'
: 'bg-white/[var(--bg-opacity-light)] dark:bg-zinc-900/[var(--bg-opacity-dark)]'
)}
- style={{
- // @ts-ignore
- '--bg-opacity-light': bgOpacityLight,
- '--bg-opacity-dark': bgOpacityDark,
- }}
+ style={
+ {
+ '--bg-opacity-light': bgOpacityLight,
+ '--bg-opacity-dark': bgOpacityDark,
+ } as React.CSSProperties
+ }
>
<div
className={clsx(
'absolute inset-x-0 top-full h-px transition',
(isInsideMobileNavigation || !mobileNavIsOpen) &&
- 'bg-zinc-900/7.5 dark:bg-white/7.5'
+ 'bg-zinc-900/7.5 dark:bg-white/7.5'
)}
/>
<Search />
@@ -64,15 +75,21 @@ export const Header = forwardRef(function Header({ className }, ref) {
<MobileNavigation />
<Link href="/" aria-label="Home">
{/* <Logo className="h-6" /> */}
- <h1 className="font-tile font-bold text-xl">E2B</h1>
+ <h1 className="font-tile text-xl font-bold">E2B</h1>
</Link>
</div>
<div className="flex items-center gap-4">
<nav className="hidden md:block">
<ul role="list" className="flex items-center gap-4">
- <TopLevelNavItem href="https://discord.gg/U7KEcGErtQ"><DiscordIcon className="h-5 w-5 fill-current" /></TopLevelNavItem>
- <TopLevelNavItem href="https://twitter.com/e2b_dev"><TwitterIcon className="h-5 w-5 fill-current" /></TopLevelNavItem>
- <TopLevelNavItem href="https://github.com/e2b-dev/e2b"><GitHubIcon className="h-5 w-5 fill-current" /></TopLevelNavItem>
+ <TopLevelNavItem href="https://discord.gg/U7KEcGErtQ">
+ <DiscordIcon className="h-5 w-5 fill-current" />
+ </TopLevelNavItem>
+ <TopLevelNavItem href="https://twitter.com/e2b_dev">
+ <TwitterIcon className="h-5 w-5 fill-current" />
+ </TopLevelNavItem>
+ <TopLevelNavItem href="https://github.com/e2b-dev/e2b">
+ <GitHubIcon className="h-5 w-5 fill-current" />
+ </TopLevelNavItem>
</ul>
</nav>
<HeaderSeparator />
diff --git a/apps/docs/src/components/HeaderUtils.tsx b/apps/docs/src/components/HeaderUtils.tsx
index bc099d0e8..b103c6ff5 100644
--- a/apps/docs/src/components/HeaderUtils.tsx
+++ b/apps/docs/src/components/HeaderUtils.tsx
@@ -1,3 +1,5 @@
export function HeaderSeparator() {
- return <div className="hidden md:block md:h-5 md:w-px md:bg-zinc-900/10 md:dark:bg-white/15" />;
+ return (
+ <div className="hidden md:block md:h-5 md:w-px md:bg-zinc-900/10 md:dark:bg-white/15" />
+ )
}
diff --git a/apps/docs/src/components/Heading.tsx b/apps/docs/src/components/Heading.tsx
index f0c54de40..8e2d471a5 100644
--- a/apps/docs/src/components/Heading.tsx
+++ b/apps/docs/src/components/Heading.tsx
@@ -8,7 +8,7 @@ import { useSectionStore } from '@/components/SectionProvider'
import { Tag } from '@/components/Tag'
import { remToPx } from '@/lib/remToPx'
-function AnchorIcon(props) {
+function AnchorIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg
viewBox="0 0 20 20"
@@ -22,7 +22,7 @@ function AnchorIcon(props) {
)
}
-function Eyebrow({ tag, label }) {
+function Eyebrow({ tag, label }: { tag?: string; label?: string }) {
if (!tag && !label) {
return null
}
@@ -40,7 +40,15 @@ function Eyebrow({ tag, label }) {
)
}
-function Anchor({ id, inView, children }) {
+function Anchor({
+ id,
+ inView,
+ children,
+}: {
+ id: string
+ inView: boolean
+ children: React.ReactNode
+}) {
return (
<Link
href={`#${id}`}
@@ -58,17 +66,23 @@ function Anchor({ id, inView, children }) {
)
}
-export function Heading({
- level = 2,
+export function Heading<Level extends 2 | 3>({
children,
- id,
tag,
label,
+ level,
anchor = true,
...props
+}: React.ComponentPropsWithoutRef<`h${Level}`> & {
+ id: string
+ tag?: string
+ label?: string
+ level?: Level
+ anchor?: boolean
}) {
- let Component = `h${level}`
- let ref = useRef()
+ level = level ?? (2 as Level)
+ let Component = `h${level}` as 'h2' | 'h3'
+ let ref = useRef<HTMLHeadingElement>(null)
let registerHeading = useSectionStore((s) => s.registerHeading)
let inView = useInView(ref, {
@@ -78,23 +92,20 @@ export function Heading({
useEffect(() => {
if (level === 2) {
- // @ts-ignore
- registerHeading({ id, ref, offsetRem: tag || label ? 8 : 6 })
+ registerHeading({ id: props.id, ref, offsetRem: tag || label ? 8 : 6 })
}
})
return (
<>
<Eyebrow tag={tag} label={label} />
- {/* @ts-ignore */}
<Component
ref={ref}
- id={anchor ? id : undefined}
className={tag || label ? 'mt-2 scroll-mt-32' : 'scroll-mt-24'}
{...props}
>
{anchor ? (
- <Anchor id={id} inView={inView}>
+ <Anchor id={props.id} inView={inView}>
{children}
</Anchor>
) : (
diff --git a/apps/docs/src/components/HeroPattern.tsx b/apps/docs/src/components/HeroPattern.tsx
index 09b235c39..0b4ca3f27 100644
--- a/apps/docs/src/components/HeroPattern.tsx
+++ b/apps/docs/src/components/HeroPattern.tsx
@@ -8,8 +8,8 @@ export function HeroPattern() {
<GridPattern
width={72}
height={56}
- x="-12"
- y="4"
+ x={-12}
+ y={4}
squares={[
[4, 3],
[2, 1],
diff --git a/apps/docs/src/components/Layout.tsx b/apps/docs/src/components/Layout.tsx
index ba1b1d139..42e5295b8 100644
--- a/apps/docs/src/components/Layout.tsx
+++ b/apps/docs/src/components/Layout.tsx
@@ -7,10 +7,15 @@ import { motion } from 'framer-motion'
import { Footer } from '@/components/Footer'
import { Header } from '@/components/Header'
import { Navigation } from '@/components/Navigation'
-import { SectionProvider } from '@/components/SectionProvider'
-import { Feedback } from '@/components/Feedback';
+import { Section, SectionProvider } from '@/components/SectionProvider'
-export function Layout({ children, allSections = {} }) {
+export function Layout({
+ children,
+ allSections,
+}: {
+ children: React.ReactNode
+ allSections: Record<string, Array<Section>>
+}) {
let pathname = usePathname()
return (
@@ -23,7 +28,7 @@ export function Layout({ children, allSections = {} }) {
<div className="contents lg:pointer-events-auto lg:block lg:w-72 lg:overflow-y-auto lg:border-r lg:border-zinc-900/10 lg:px-6 lg:pb-8 lg:pt-4 lg:dark:border-white/10 xl:w-80">
<div className="hidden lg:flex">
<Link href="/" aria-label="Home">
- <h1 className="font-bold text-xl">E2B</h1>
+ <h1 className="text-xl font-bold">E2B</h1>
{/* <Logo className="h-6" /> */}
</Link>
</div>
@@ -32,9 +37,7 @@ export function Layout({ children, allSections = {} }) {
</div>
</motion.header>
<div className="relative flex h-full flex-col px-4 pt-14 sm:px-6 lg:px-8">
- <main className="flex-auto">
- {children}
- </main>
+ <main className="flex-auto">{children}</main>
<Footer />
</div>
</div>
diff --git a/apps/docs/src/components/MobileNavigation.tsx b/apps/docs/src/components/MobileNavigation.tsx
index 03f0d18d3..e021f5243 100644
--- a/apps/docs/src/components/MobileNavigation.tsx
+++ b/apps/docs/src/components/MobileNavigation.tsx
@@ -1,6 +1,13 @@
'use client'
-import { createContext, Fragment, useContext, useEffect, useRef } from 'react'
+import {
+ createContext,
+ Fragment,
+ Suspense,
+ useContext,
+ useEffect,
+ useRef,
+} from 'react'
import { usePathname, useSearchParams } from 'next/navigation'
import { Dialog, Transition } from '@headlessui/react'
import { motion } from 'framer-motion'
@@ -9,7 +16,7 @@ import { create } from 'zustand'
import { Header } from '@/components/Header'
import { Navigation } from '@/components/Navigation'
-function MenuIcon(props) {
+function MenuIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg
viewBox="0 0 10 9"
@@ -23,7 +30,7 @@ function MenuIcon(props) {
)
}
-function XIcon(props) {
+function XIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg
viewBox="0 0 10 9"
@@ -39,22 +46,13 @@ function XIcon(props) {
const IsInsideMobileNavigationContext = createContext(false)
-export function useIsInsideMobileNavigation() {
- return useContext(IsInsideMobileNavigationContext)
-}
-
-export const useMobileNavigationStore = create((set) => ({
- isOpen: false,
- open: () => set({ isOpen: true }),
- close: () => set({ isOpen: false }),
- toggle: () => set((state) => ({ isOpen: !state.isOpen })),
-}))
-
-export function MobileNavigation() {
- let isInsideMobileNavigation = useIsInsideMobileNavigation()
- // @ts-ignore
- let { isOpen, toggle, close } = useMobileNavigationStore()
- let ToggleIcon = isOpen ? XIcon : MenuIcon
+function MobileNavigationDialog({
+ isOpen,
+ close,
+}: {
+ isOpen: boolean
+ close: () => void
+}) {
let pathname = usePathname()
let searchParams = useSearchParams()
let initialPathname = useRef(pathname).current
@@ -66,7 +64,11 @@ export function MobileNavigation() {
}
}, [pathname, searchParams, close, initialPathname, initialSearchParams])
- function onClickDialog(event) {
+ function onClickDialog(event: React.MouseEvent<HTMLDivElement>) {
+ if (!(event.target instanceof HTMLElement)) {
+ return
+ }
+
let link = event.target.closest('a')
if (
link &&
@@ -77,6 +79,81 @@ export function MobileNavigation() {
}
}
+ return (
+ <Transition.Root show={isOpen} as={Fragment}>
+ <Dialog
+ onClickCapture={onClickDialog}
+ onClose={close}
+ className="fixed inset-0 z-50 lg:hidden"
+ >
+ <Transition.Child
+ as={Fragment}
+ enter="duration-300 ease-out"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="duration-200 ease-in"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ >
+ <div className="fixed inset-0 top-14 bg-zinc-400/20 backdrop-blur-sm dark:bg-black/40" />
+ </Transition.Child>
+
+ <Dialog.Panel>
+ <Transition.Child
+ as={Fragment}
+ enter="duration-300 ease-out"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="duration-200 ease-in"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ >
+ <Header />
+ </Transition.Child>
+
+ <Transition.Child
+ as={Fragment}
+ enter="duration-500 ease-in-out"
+ enterFrom="-translate-x-full"
+ enterTo="translate-x-0"
+ leave="duration-500 ease-in-out"
+ leaveFrom="translate-x-0"
+ leaveTo="-translate-x-full"
+ >
+ <motion.div
+ layoutScroll
+ className="fixed bottom-0 left-0 top-14 w-full overflow-y-auto bg-white px-4 pb-4 pt-6 shadow-lg shadow-zinc-900/10 ring-1 ring-zinc-900/7.5 dark:bg-zinc-900 dark:ring-zinc-800 min-[416px]:max-w-sm sm:px-6 sm:pb-10"
+ >
+ <Navigation />
+ </motion.div>
+ </Transition.Child>
+ </Dialog.Panel>
+ </Dialog>
+ </Transition.Root>
+ )
+}
+
+export function useIsInsideMobileNavigation() {
+ return useContext(IsInsideMobileNavigationContext)
+}
+
+export const useMobileNavigationStore = create<{
+ isOpen: boolean
+ open: () => void
+ close: () => void
+ toggle: () => void
+}>()((set) => ({
+ isOpen: false,
+ open: () => set({ isOpen: true }),
+ close: () => set({ isOpen: false }),
+ toggle: () => set((state) => ({ isOpen: !state.isOpen })),
+}))
+
+export function MobileNavigation() {
+ let isInsideMobileNavigation = useIsInsideMobileNavigation()
+ let { isOpen, toggle, close } = useMobileNavigationStore()
+ let ToggleIcon = isOpen ? XIcon : MenuIcon
+
return (
<IsInsideMobileNavigationContext.Provider value={true}>
<button
@@ -88,56 +165,9 @@ export function MobileNavigation() {
<ToggleIcon className="w-2.5 stroke-zinc-900 dark:stroke-white" />
</button>
{!isInsideMobileNavigation && (
- <Transition.Root show={isOpen} as={Fragment}>
- <Dialog
- onClickCapture={onClickDialog}
- onClose={close}
- className="fixed inset-0 z-50 lg:hidden"
- >
- <Transition.Child
- as={Fragment}
- enter="duration-300 ease-out"
- enterFrom="opacity-0"
- enterTo="opacity-100"
- leave="duration-200 ease-in"
- leaveFrom="opacity-100"
- leaveTo="opacity-0"
- >
- <div className="fixed inset-0 top-14 bg-zinc-400/20 backdrop-blur-sm dark:bg-black/40" />
- </Transition.Child>
-
- <Dialog.Panel>
- <Transition.Child
- as={Fragment}
- enter="duration-300 ease-out"
- enterFrom="opacity-0"
- enterTo="opacity-100"
- leave="duration-200 ease-in"
- leaveFrom="opacity-100"
- leaveTo="opacity-0"
- >
- <Header />
- </Transition.Child>
-
- <Transition.Child
- as={Fragment}
- enter="duration-500 ease-in-out"
- enterFrom="-translate-x-full"
- enterTo="translate-x-0"
- leave="duration-500 ease-in-out"
- leaveFrom="translate-x-0"
- leaveTo="-translate-x-full"
- >
- <motion.div
- layoutScroll
- className="fixed bottom-0 left-0 top-14 w-full overflow-y-auto bg-white px-4 pb-4 pt-6 shadow-lg shadow-zinc-900/10 ring-1 ring-zinc-900/7.5 dark:bg-zinc-900 dark:ring-zinc-800 min-[540px]:max-w-sm sm:px-6 sm:pb-10"
- >
- <Navigation />
- </motion.div>
- </Transition.Child>
- </Dialog.Panel>
- </Dialog>
- </Transition.Root>
+ <Suspense fallback={null}>
+ <MobileNavigationDialog isOpen={isOpen} close={close} />
+ </Suspense>
)}
</IsInsideMobileNavigationContext.Provider>
)
diff --git a/apps/docs/src/components/Navigation.tsx b/apps/docs/src/components/Navigation.tsx
index eba74daee..4e42de37b 100644
--- a/apps/docs/src/components/Navigation.tsx
+++ b/apps/docs/src/components/Navigation.tsx
@@ -6,20 +6,33 @@ import { usePathname } from 'next/navigation'
import clsx from 'clsx'
import { AnimatePresence, motion, useIsPresent } from 'framer-motion'
-import { Button } from '@/components/Button'
import { useIsInsideMobileNavigation } from '@/components/MobileNavigation'
import { useSectionStore } from '@/components/SectionProvider'
import { Tag } from '@/components/Tag'
import { remToPx } from '@/lib/remToPx'
-import { Auth } from '@/components/Auth';
-import { Feedback } from '@/components/Feedback';
+import { Auth } from '@/components/Auth'
+import { Feedback } from '@/components/Feedback'
-function useInitialValue(value, condition = true) {
+interface NavGroup {
+ title: string
+ links: Array<{
+ title: string
+ href: string
+ }>
+}
+
+function useInitialValue<T>(value: T, condition = true) {
let initialValue = useRef(value).current
return condition ? initialValue : value
}
-function TopLevelNavItem({ href, children }) {
+function TopLevelNavItem({
+ href,
+ children,
+}: {
+ href: string
+ children: React.ReactNode
+}) {
return (
<li className="md:hidden">
<Link
@@ -32,7 +45,21 @@ function TopLevelNavItem({ href, children }) {
)
}
-function NavLink({ isFontMono, href, tag, active, isAnchorLink = false, children }) {
+function NavLink({
+ href,
+ children,
+ tag,
+ active = false,
+ isAnchorLink = false,
+ isFontMono = false,
+}: {
+ href: string
+ children: React.ReactNode
+ tag?: string
+ active?: boolean
+ isAnchorLink?: boolean
+ isFontMono?: boolean
+}) {
return (
<Link
href={href}
@@ -77,7 +104,8 @@ function VisibleSectionHighlight({ group, pathname }) {
? Math.max(1, visibleSections.length) * itemHeight
: itemHeight
let top =
- group.links.findIndex((link) => `/docs${link.href}` === pathname) * itemHeight +
+ group.links.findIndex((link) => `/docs${link.href}` === pathname) *
+ itemHeight +
firstVisibleSectionIndex * itemHeight
return (
@@ -92,10 +120,18 @@ function VisibleSectionHighlight({ group, pathname }) {
)
}
-function ActivePageMarker({ group, pathname }) {
+function ActivePageMarker({
+ group,
+ pathname,
+}: {
+ group: NavGroup
+ pathname: string
+}) {
let itemHeight = remToPx(2)
let offset = remToPx(0.25)
- let activePageIndex = group.links.findIndex((link) => `/docs${link.href}` === pathname)
+ let activePageIndex = group.links.findIndex(
+ (link) => `/docs${link.href}` === pathname
+ )
let top = offset + activePageIndex * itemHeight
return (
@@ -150,7 +186,11 @@ function NavigationGroup({ group, className }) {
{group.links.map((link) => (
<motion.li key={link.href} layout="position" className="relative">
{/* @ts-ignore */}
- <NavLink href={link.href} active={`/docs${link.href}` === pathname} isFontMono={link.isFontMono}>
+ <NavLink
+ href={link.href}
+ active={`/docs${link.href}` === pathname}
+ isFontMono={link.isFontMono}
+ >
{link.title}
</NavLink>
<AnimatePresence mode="popLayout" initial={false}>
@@ -255,26 +295,26 @@ export const navigation = [
// ],
// },
// {
- // title: 'SDK Reference',
- // links: [
- // { title: 'E2B', href: '/reference/e2b', isFontMono: true },
+ // title: 'SDK Reference',
+ // links: [
+ // { title: 'E2B', href: '/reference/e2b', isFontMono: true },
- // Primitives
- // { title: 'e2b.process', href: '/reference/python/process', isFontMono: true },
- // { title: 'e2b.filesystem', href: '/reference/python/filesystem', isFontMono: true },
- // { title: 'e2b.http', href: '/reference/python/http', isFontMono: true },
- // { title: 'e2b.code', href: '/reference/python/code', isFontMono: true },
+ // Primitives
+ // { title: 'e2b.process', href: '/reference/python/process', isFontMono: true },
+ // { title: 'e2b.filesystem', href: '/reference/python/filesystem', isFontMono: true },
+ // { title: 'e2b.http', href: '/reference/python/http', isFontMono: true },
+ // { title: 'e2b.code', href: '/reference/python/code', isFontMono: true },
- // High-level modules
- // { title: 'e2b.code', href: '/reference/code', isFontMono: true },
- // { title: 'e2b.browser', href: '/reference/browser', isFontMono: true },
- // { title: 'e2b.chart', href: '/reference/chart', isFontMono: true },
- // { title: 'e2b.storage', href: '/reference/storage', isFontMono: true },
- // { title: 'e2b.auth', href: '/reference/auth', isFontMono: true },
- // { title: 'e2b.datasource', href: '/reference/data', isFontMono: true },
- // { title: 'e2b.skills', href: '/reference/skills', isFontMono: true },
- // { title: 'e2b.spreadsheet', href: '/reference/spreadsheet', isFontMono: true },
- // ],
+ // High-level modules
+ // { title: 'e2b.code', href: '/reference/code', isFontMono: true },
+ // { title: 'e2b.browser', href: '/reference/browser', isFontMono: true },
+ // { title: 'e2b.chart', href: '/reference/chart', isFontMono: true },
+ // { title: 'e2b.storage', href: '/reference/storage', isFontMono: true },
+ // { title: 'e2b.auth', href: '/reference/auth', isFontMono: true },
+ // { title: 'e2b.datasource', href: '/reference/data', isFontMono: true },
+ // { title: 'e2b.skills', href: '/reference/skills', isFontMono: true },
+ // { title: 'e2b.spreadsheet', href: '/reference/spreadsheet', isFontMono: true },
+ // ],
// },
]
diff --git a/apps/docs/src/components/Prose.tsx b/apps/docs/src/components/Prose.tsx
index 8161466d0..a6bb5f168 100644
--- a/apps/docs/src/components/Prose.tsx
+++ b/apps/docs/src/components/Prose.tsx
@@ -1,9 +1,17 @@
import clsx from 'clsx'
-export function Prose({ as: Component = 'div', className, ...props }) {
+export function Prose<T extends React.ElementType = 'div'>({
+ as,
+ className,
+ ...props
+}: Omit<React.ComponentPropsWithoutRef<T>, 'as' | 'className'> & {
+ as?: T
+ className?: string
+}) {
+ let Component = as ?? 'div'
+
return (
<Component
- // @ts-ignore
className={clsx(className, 'prose dark:prose-invert')}
{...props}
/>
diff --git a/apps/docs/src/components/Search.tsx b/apps/docs/src/components/Search.tsx
index 9a453af79..f079d7edd 100644
--- a/apps/docs/src/components/Search.tsx
+++ b/apps/docs/src/components/Search.tsx
@@ -3,6 +3,7 @@
import {
forwardRef,
Fragment,
+ Suspense,
useCallback,
useEffect,
useId,
@@ -11,18 +12,39 @@ import {
} from 'react'
import Highlighter from 'react-highlight-words'
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
-import { createAutocomplete } from '@algolia/autocomplete-core'
+import {
+ type AutocompleteApi,
+ createAutocomplete,
+ type AutocompleteState,
+ type AutocompleteCollection,
+} from '@algolia/autocomplete-core'
import clsx from 'clsx'
import { navigation } from '@/components/Navigation'
-import { DialogAnimated } from '@/components/DialogAnimated';
+import { type Result } from '@/mdx/search.mjs'
+import { DialogAnimated } from '@/components/DialogAnimated'
+
+type EmptyObject = Record<string, never>
-function useAutocomplete({ close }) {
+type Autocomplete = AutocompleteApi<
+ Result,
+ React.SyntheticEvent,
+ React.MouseEvent,
+ React.KeyboardEvent
+>
+
+function useAutocomplete({ close }: { close: () => void }) {
let id = useId()
let router = useRouter()
- let [autocompleteState, setAutocompleteState] = useState({})
+ let [autocompleteState, setAutocompleteState] = useState<
+ AutocompleteState<Result> | EmptyObject
+ >({})
+
+ function navigate({ itemUrl }: { itemUrl?: string }) {
+ if (!itemUrl) {
+ return
+ }
- function navigate({ itemUrl }) {
router.push(itemUrl)
if (
@@ -33,8 +55,13 @@ function useAutocomplete({ close }) {
}
}
- let [autocomplete] = useState(() =>
- createAutocomplete({
+ let [autocomplete] = useState<Autocomplete>(() =>
+ createAutocomplete<
+ Result,
+ React.SyntheticEvent,
+ React.MouseEvent,
+ React.KeyboardEvent
+ >({
id,
placeholder: 'Find something...',
defaultActiveItemId: 0,
@@ -47,9 +74,7 @@ function useAutocomplete({ close }) {
navigator: {
navigate,
},
- // @ts-ignore
getSources({ query }) {
- // @ts-ignore
return import('@/mdx/search.mjs').then(({ search }) => {
return [
{
@@ -71,7 +96,7 @@ function useAutocomplete({ close }) {
return { autocomplete, autocompleteState }
}
-function SearchIcon(props) {
+function SearchIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
<path
@@ -83,7 +108,7 @@ function SearchIcon(props) {
)
}
-function NoResultsIcon(props) {
+function NoResultsIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
<path
@@ -95,7 +120,7 @@ function NoResultsIcon(props) {
)
}
-function LoadingIcon(props) {
+function LoadingIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
let id = useId()
return (
@@ -124,7 +149,7 @@ function LoadingIcon(props) {
)
}
-function HighlightQuery({ text, query }) {
+function HighlightQuery({ text, query }: { text: string; query: string }) {
return (
<Highlighter
highlightClassName="underline bg-transparent text-emerald-500"
@@ -141,13 +166,21 @@ function SearchResult({
autocomplete,
collection,
query,
+}: {
+ result: Result
+ resultIndex: number
+ autocomplete: Autocomplete
+ collection: AutocompleteCollection<Result>
+ query: string
}) {
let id = useId()
let sectionTitle = navigation.find((section) =>
section.links.find((link) => link.href === result.url.split('#')[0])
)?.title
- let hierarchy = [sectionTitle, result.pageTitle].filter(Boolean)
+ let hierarchy = [sectionTitle, result.pageTitle].filter(
+ (x): x is string => typeof x === 'string'
+ )
return (
<li
@@ -194,7 +227,15 @@ function SearchResult({
)
}
-function SearchResults({ autocomplete, query, collection }) {
+function SearchResults({
+ autocomplete,
+ query,
+ collection,
+}: {
+ autocomplete: Autocomplete
+ query: string
+ collection: AutocompleteCollection<Result>
+}) {
if (collection.items.length === 0) {
return (
<div className="p-6 text-center">
@@ -211,7 +252,7 @@ function SearchResults({ autocomplete, query, collection }) {
}
return (
- <ul role="list" {...autocomplete.getListProps()}>
+ <ul {...autocomplete.getListProps()}>
{collection.items.map((result, resultIndex) => (
<SearchResult
key={result.url}
@@ -226,12 +267,15 @@ function SearchResults({ autocomplete, query, collection }) {
)
}
-const SearchInput = forwardRef(function SearchInput(
- // @ts-ignore
- { autocomplete, autocompleteState, onClose },
- inputRef
-) {
- let inputProps = autocomplete.getInputProps({})
+const SearchInput = forwardRef<
+ React.ElementRef<'input'>,
+ {
+ autocomplete: Autocomplete
+ autocompleteState: AutocompleteState<Result> | EmptyObject
+ onClose: () => void
+ }
+>(function SearchInput({ autocomplete, autocompleteState, onClose }, inputRef) {
+ let inputProps = autocomplete.getInputProps({ inputElement: null })
return (
<div className="group relative flex h-12">
@@ -251,8 +295,9 @@ const SearchInput = forwardRef(function SearchInput(
) {
// In Safari, closing the dialog with the escape key can sometimes cause the scroll position to jump to the
// bottom of the page. This is a workaround for that until we can figure out a proper fix in Headless UI.
- // @ts-ignore
- document.activeElement?.blur()
+ if (document.activeElement instanceof HTMLElement) {
+ document.activeElement.blur()
+ }
onClose()
} else {
@@ -269,10 +314,18 @@ const SearchInput = forwardRef(function SearchInput(
)
})
-function SearchDialog({ open, setOpen, className }) {
- let formRef = useRef()
- let panelRef = useRef()
- let inputRef = useRef()
+function SearchDialog({
+ open,
+ setOpen,
+ className,
+}: {
+ open: boolean
+ setOpen: (open: boolean) => void
+ className?: string
+}) {
+ let formRef = useRef<React.ElementRef<'form'>>(null)
+ let panelRef = useRef<React.ElementRef<'div'>>(null)
+ let inputRef = useRef<React.ElementRef<typeof SearchInput>>(null)
let { autocomplete, autocompleteState } = useAutocomplete({
close() {
setOpen(false)
@@ -290,7 +343,7 @@ function SearchDialog({ open, setOpen, className }) {
return
}
- function onKeyDown(event) {
+ function onKeyDown(event: KeyboardEvent) {
if (event.key === 'k' && (event.metaKey || event.ctrlKey)) {
event.preventDefault()
setOpen(true)
@@ -303,52 +356,54 @@ function SearchDialog({ open, setOpen, className }) {
window.removeEventListener('keydown', onKeyDown)
}
}, [open, setOpen])
-
- return <DialogAnimated
- open={open}
- setOpen={setOpen}
- as={Fragment}
- className={className}
- afterLeave={() => autocomplete.setQuery('')}
- rootProps={autocomplete.getRootProps({})}
- >
- {/* @ts-ignore */}
- <form
- ref={formRef}
- {...autocomplete.getFormProps({
- inputElement: inputRef.current,
- })}
+
+ return (
+ <DialogAnimated
+ open={open}
+ setOpen={setOpen}
+ as={Fragment}
+ className={className}
+ afterLeave={() => autocomplete.setQuery('')}
+ rootProps={autocomplete.getRootProps({})}
>
- <SearchInput
- ref={inputRef}
- // @ts-ignore
- autocomplete={autocomplete}
- autocompleteState={autocompleteState}
- onClose={() => setOpen(false)}
- />
{/* @ts-ignore */}
- <div
- ref={panelRef}
- className="border-t border-zinc-200 bg-white empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5"
- {...autocomplete.getPanelProps({})}
+ <form
+ ref={formRef}
+ {...autocomplete.getFormProps({
+ inputElement: inputRef.current,
+ })}
>
+ <SearchInput
+ ref={inputRef}
+ // @ts-ignore
+ autocomplete={autocomplete}
+ autocompleteState={autocompleteState}
+ onClose={() => setOpen(false)}
+ />
{/* @ts-ignore */}
- {autocompleteState.isOpen && (
- <SearchResults
- autocomplete={autocomplete}
- // @ts-ignore
- query={autocompleteState.query}
- // @ts-ignore
- collection={autocompleteState.collections[0]}
- />
- )}
- </div>
- </form>
- </DialogAnimated>
+ <div
+ ref={panelRef}
+ className="border-t border-zinc-200 bg-white empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5"
+ {...autocomplete.getPanelProps({})}
+ >
+ {/* @ts-ignore */}
+ {autocompleteState.isOpen && (
+ <SearchResults
+ autocomplete={autocomplete}
+ // @ts-ignore
+ query={autocompleteState.query}
+ // @ts-ignore
+ collection={autocompleteState.collections[0]}
+ />
+ )}
+ </div>
+ </form>
+ </DialogAnimated>
+ )
}
function useSearchProps() {
- let buttonRef = useRef()
+ let buttonRef = useRef<React.ElementRef<'button'>>(null)
let [open, setOpen] = useState(false)
return {
@@ -360,16 +415,10 @@ function useSearchProps() {
},
dialogProps: {
open,
- // setOpen(open) {
- // let { width, height } = buttonRef.current.getBoundingClientRect()
- // if (!open || (width !== 0 && height !== 0)) {
- // setOpen(open)
- // }
- // },
setOpen: useCallback(
- (open) => {
- // @ts-ignore
- let { width, height } = buttonRef.current.getBoundingClientRect()
+ (open: boolean) => {
+ let { width = 0, height = 0 } =
+ buttonRef.current?.getBoundingClientRect() ?? {}
if (!open || (width !== 0 && height !== 0)) {
setOpen(open)
}
@@ -381,12 +430,11 @@ function useSearchProps() {
}
export function Search() {
- let [modifierKey, setModifierKey] = useState()
+ let [modifierKey, setModifierKey] = useState<string>()
let { buttonProps, dialogProps } = useSearchProps()
useEffect(() => {
setModifierKey(
- // @ts-ignore
/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? '⌘' : 'Ctrl '
)
}, [])
@@ -405,7 +453,9 @@ export function Search() {
<kbd className="font-sans">K</kbd>
</kbd>
</button>
- <SearchDialog className="hidden lg:block" {...dialogProps} />
+ <Suspense fallback={null}>
+ <SearchDialog className="hidden lg:block" {...dialogProps} />
+ </Suspense>
</div>
)
}
@@ -423,7 +473,9 @@ export function MobileSearch() {
>
<SearchIcon className="h-5 w-5 stroke-zinc-900 dark:stroke-white" />
</button>
- <SearchDialog className="lg:hidden" {...dialogProps} />
+ <Suspense fallback={null}>
+ <SearchDialog className="lg:hidden" {...dialogProps} />
+ </Suspense>
</div>
)
}
diff --git a/apps/docs/src/components/SectionProvider.tsx b/apps/docs/src/components/SectionProvider.tsx
index d7f87081f..d785ea203 100644
--- a/apps/docs/src/components/SectionProvider.tsx
+++ b/apps/docs/src/components/SectionProvider.tsx
@@ -7,12 +7,35 @@ import {
useLayoutEffect,
useState,
} from 'react'
-import { createStore, useStore } from 'zustand'
+import { type StoreApi, createStore, useStore } from 'zustand'
import { remToPx } from '@/lib/remToPx'
-function createSectionStore(sections) {
- return createStore((set) => ({
+export interface Section {
+ id: string
+ title: string
+ offsetRem?: number
+ tag?: string
+ headingRef?: React.RefObject<HTMLHeadingElement>
+}
+
+interface SectionState {
+ sections: Array<Section>
+ visibleSections: Array<string>
+ setVisibleSections: (visibleSections: Array<string>) => void
+ registerHeading: ({
+ id,
+ ref,
+ offsetRem,
+ }: {
+ id: string
+ ref: React.RefObject<HTMLHeadingElement>
+ offsetRem: number
+ }) => void
+}
+
+function createSectionStore(sections: Array<Section>) {
+ return createStore<SectionState>()((set) => ({
sections,
visibleSections: [],
setVisibleSections: (visibleSections) =>
@@ -39,8 +62,7 @@ function createSectionStore(sections) {
}))
}
-function useVisibleSections(sectionStore) {
- // @ts-ignore
+function useVisibleSections(sectionStore: StoreApi<SectionState>) {
let setVisibleSections = useStore(sectionStore, (s) => s.setVisibleSections)
// @ts-ignore
let sections = useStore(sectionStore, (s) => s.sections)
@@ -55,7 +77,12 @@ function useVisibleSections(sectionStore) {
sectionIndex < sections.length;
sectionIndex++
) {
- let { id, headingRef, offsetRem } = sections[sectionIndex]
+ let { id, headingRef, offsetRem = 0 } = sections[sectionIndex]
+
+ if (!headingRef?.current) {
+ continue
+ }
+
let offset = remToPx(offsetRem)
let top = headingRef.current.getBoundingClientRect().top + scrollY
@@ -65,7 +92,7 @@ function useVisibleSections(sectionStore) {
let nextSection = sections[sectionIndex + 1]
let bottom =
- (nextSection?.headingRef.current.getBoundingClientRect().top ??
+ (nextSection?.headingRef?.current?.getBoundingClientRect().top ??
Infinity) +
scrollY -
remToPx(nextSection?.offsetRem ?? 0)
@@ -94,13 +121,18 @@ function useVisibleSections(sectionStore) {
}, [setVisibleSections, sections])
}
-// @ts-ignore
-const SectionStoreContext = createContext()
+const SectionStoreContext = createContext<StoreApi<SectionState> | null>(null)
const useIsomorphicLayoutEffect =
typeof window === 'undefined' ? useEffect : useLayoutEffect
-export function SectionProvider({ sections, children }) {
+export function SectionProvider({
+ sections,
+ children,
+}: {
+ sections: Array<Section>
+ children: React.ReactNode
+}) {
let [sectionStore] = useState(() => createSectionStore(sections))
useVisibleSections(sectionStore)
@@ -116,8 +148,7 @@ export function SectionProvider({ sections, children }) {
)
}
-export function useSectionStore(selector) {
+export function useSectionStore<T>(selector: (state: SectionState) => T) {
let store = useContext(SectionStoreContext)
- // @ts-ignore
- return useStore(store, selector)
+ return useStore(store!, selector)
}
diff --git a/apps/docs/src/components/Tag.tsx b/apps/docs/src/components/Tag.tsx
index 902cb8f57..da4dfcaad 100644
--- a/apps/docs/src/components/Tag.tsx
+++ b/apps/docs/src/components/Tag.tsx
@@ -1,6 +1,7 @@
import clsx from 'clsx'
const variantStyles = {
+ small: '',
medium: 'rounded-lg px-1.5 ring-1 ring-inset',
}
@@ -33,16 +34,20 @@ const colorStyles = {
}
const valueColorMap = {
- get: 'emerald',
- post: 'sky',
- put: 'amber',
- delete: 'rose',
-}
+ GET: 'emerald',
+ POST: 'sky',
+ PUT: 'amber',
+ DELETE: 'rose',
+} as Record<string, keyof typeof colorStyles>
export function Tag({
children,
variant = 'medium',
- color = valueColorMap[children.toLowerCase()] ?? 'emerald',
+ color = valueColorMap[children] ?? 'emerald',
+}: {
+ children: keyof typeof valueColorMap & (string | {})
+ variant?: keyof typeof variantStyles
+ color?: keyof typeof colorStyles
}) {
return (
<span
diff --git a/apps/docs/src/components/Textarea.tsx b/apps/docs/src/components/Textarea.tsx
index b82bce495..996d5f1b8 100644
--- a/apps/docs/src/components/Textarea.tsx
+++ b/apps/docs/src/components/Textarea.tsx
@@ -1,5 +1,5 @@
import clsx from 'clsx'
-import { useEffect, useRef } from 'react'
+import { useEffect, useRef } from 'react'
// export interface Props {
// value: string
@@ -12,12 +12,15 @@ import { useEffect, useRef } from 'react'
function Textarea({ value = '', className, placeholder, onChange, isOpen }) {
const ref = useRef(null)
- useEffect(function handleFocus() {
- if (!ref) return
- if (isOpen) {
- ref.current?.focus()
- }
- }, [isOpen])
+ useEffect(
+ function handleFocus() {
+ if (!ref) return
+ if (isOpen) {
+ ref.current?.focus()
+ }
+ },
+ [isOpen]
+ )
return (
<textarea
@@ -44,7 +47,7 @@ function Textarea({ value = '', className, placeholder, onChange, isOpen }) {
'transition-colors',
'text-white',
'placeholder:text-gray-500',
- className,
+ className
)}
onChange={onChange}
/>
diff --git a/apps/docs/src/components/ThemeToggle.tsx b/apps/docs/src/components/ThemeToggle.tsx
index 3c3a93ccd..eb9969fd7 100644
--- a/apps/docs/src/components/ThemeToggle.tsx
+++ b/apps/docs/src/components/ThemeToggle.tsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import { useTheme } from 'next-themes'
-function SunIcon(props) {
+function SunIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
<path d="M12.5 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z" />
@@ -13,7 +13,7 @@ function SunIcon(props) {
)
}
-function MoonIcon(props) {
+function MoonIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
<path d="M15.224 11.724a5.5 5.5 0 0 1-6.949-6.949 5.5 5.5 0 1 0 6.949 6.949Z" />
diff --git a/apps/docs/src/components/icons/BellIcon.tsx b/apps/docs/src/components/icons/BellIcon.tsx
index 09062dd9b..1c0c2291c 100644
--- a/apps/docs/src/components/icons/BellIcon.tsx
+++ b/apps/docs/src/components/icons/BellIcon.tsx
@@ -1,4 +1,4 @@
-export function BellIcon(props) {
+export function BellIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/BoltIcon.tsx b/apps/docs/src/components/icons/BoltIcon.tsx
index 1278a7fe8..308d997cc 100644
--- a/apps/docs/src/components/icons/BoltIcon.tsx
+++ b/apps/docs/src/components/icons/BoltIcon.tsx
@@ -1,4 +1,4 @@
-export function BoltIcon(props) {
+export function BoltIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/BookIcon.tsx b/apps/docs/src/components/icons/BookIcon.tsx
index d560f41c8..9f7709bc3 100644
--- a/apps/docs/src/components/icons/BookIcon.tsx
+++ b/apps/docs/src/components/icons/BookIcon.tsx
@@ -1,4 +1,4 @@
-export function BookIcon(props) {
+export function BookIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/CalendarIcon.tsx b/apps/docs/src/components/icons/CalendarIcon.tsx
index 8d0a57c8d..e9d374867 100644
--- a/apps/docs/src/components/icons/CalendarIcon.tsx
+++ b/apps/docs/src/components/icons/CalendarIcon.tsx
@@ -1,4 +1,4 @@
-export function CalendarIcon(props) {
+export function CalendarIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/CartIcon.tsx b/apps/docs/src/components/icons/CartIcon.tsx
index e42462467..30c9438f7 100644
--- a/apps/docs/src/components/icons/CartIcon.tsx
+++ b/apps/docs/src/components/icons/CartIcon.tsx
@@ -1,4 +1,4 @@
-export function CartIcon(props) {
+export function CartIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/ChatBubbleIcon.tsx b/apps/docs/src/components/icons/ChatBubbleIcon.tsx
index b929ec643..418427b05 100644
--- a/apps/docs/src/components/icons/ChatBubbleIcon.tsx
+++ b/apps/docs/src/components/icons/ChatBubbleIcon.tsx
@@ -1,4 +1,4 @@
-export function ChatBubbleIcon(props) {
+export function ChatBubbleIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/CheckIcon.tsx b/apps/docs/src/components/icons/CheckIcon.tsx
index 33d2b249a..b9433644d 100644
--- a/apps/docs/src/components/icons/CheckIcon.tsx
+++ b/apps/docs/src/components/icons/CheckIcon.tsx
@@ -1,4 +1,4 @@
-export function CheckIcon(props) {
+export function CheckIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/ChevronRightLeftIcon.tsx b/apps/docs/src/components/icons/ChevronRightLeftIcon.tsx
index 2dbaa18c4..51144c0fd 100644
--- a/apps/docs/src/components/icons/ChevronRightLeftIcon.tsx
+++ b/apps/docs/src/components/icons/ChevronRightLeftIcon.tsx
@@ -1,4 +1,6 @@
-export function ChevronRightLeftIcon(props) {
+export function ChevronRightLeftIcon(
+ props: React.ComponentPropsWithoutRef<'svg'>
+) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/ClipboardIcon.tsx b/apps/docs/src/components/icons/ClipboardIcon.tsx
index 9c8c55cee..33d997b5b 100644
--- a/apps/docs/src/components/icons/ClipboardIcon.tsx
+++ b/apps/docs/src/components/icons/ClipboardIcon.tsx
@@ -1,4 +1,4 @@
-export function ClipboardIcon(props) {
+export function ClipboardIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/CogIcon.tsx b/apps/docs/src/components/icons/CogIcon.tsx
index 57023fc7c..cedecf542 100644
--- a/apps/docs/src/components/icons/CogIcon.tsx
+++ b/apps/docs/src/components/icons/CogIcon.tsx
@@ -1,4 +1,4 @@
-export function CogIcon(props) {
+export function CogIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/CopyIcon.tsx b/apps/docs/src/components/icons/CopyIcon.tsx
index aadede17d..0eedaaa4c 100644
--- a/apps/docs/src/components/icons/CopyIcon.tsx
+++ b/apps/docs/src/components/icons/CopyIcon.tsx
@@ -1,4 +1,4 @@
-export function CopyIcon(props) {
+export function CopyIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/DiscordIcon.tsx b/apps/docs/src/components/icons/DiscordIcon.tsx
index 4a081e678..daaf5bb86 100644
--- a/apps/docs/src/components/icons/DiscordIcon.tsx
+++ b/apps/docs/src/components/icons/DiscordIcon.tsx
@@ -1,9 +1,7 @@
export function DiscordIcon(props) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
- <path
- d="M16.238 4.515a14.842 14.842 0 0 0-3.664-1.136.055.055 0 0 0-.059.027 10.35 10.35 0 0 0-.456.938 13.702 13.702 0 0 0-4.115 0 9.479 9.479 0 0 0-.464-.938.058.058 0 0 0-.058-.027c-1.266.218-2.497.6-3.664 1.136a.052.052 0 0 0-.024.02C1.4 8.023.76 11.424 1.074 14.782a.062.062 0 0 0 .024.042 14.923 14.923 0 0 0 4.494 2.272.058.058 0 0 0 .064-.02c.346-.473.654-.972.92-1.496a.057.057 0 0 0-.032-.08 9.83 9.83 0 0 1-1.404-.669.058.058 0 0 1-.029-.046.058.058 0 0 1 .023-.05c.094-.07.189-.144.279-.218a.056.056 0 0 1 .058-.008c2.946 1.345 6.135 1.345 9.046 0a.056.056 0 0 1 .059.007c.09.074.184.149.28.22a.058.058 0 0 1 .023.049.059.059 0 0 1-.028.046 9.224 9.224 0 0 1-1.405.669.058.058 0 0 0-.033.033.056.056 0 0 0 .002.047c.27.523.58 1.022.92 1.495a.056.056 0 0 0 .062.021 14.878 14.878 0 0 0 4.502-2.272.055.055 0 0 0 .016-.018.056.056 0 0 0 .008-.023c.375-3.883-.63-7.256-2.662-10.246a.046.046 0 0 0-.023-.021Zm-9.223 8.221c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.717 1.814-1.618 1.814Zm5.981 0c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.71 1.814-1.618 1.814Z"
- />
+ <path d="M16.238 4.515a14.842 14.842 0 0 0-3.664-1.136.055.055 0 0 0-.059.027 10.35 10.35 0 0 0-.456.938 13.702 13.702 0 0 0-4.115 0 9.479 9.479 0 0 0-.464-.938.058.058 0 0 0-.058-.027c-1.266.218-2.497.6-3.664 1.136a.052.052 0 0 0-.024.02C1.4 8.023.76 11.424 1.074 14.782a.062.062 0 0 0 .024.042 14.923 14.923 0 0 0 4.494 2.272.058.058 0 0 0 .064-.02c.346-.473.654-.972.92-1.496a.057.057 0 0 0-.032-.08 9.83 9.83 0 0 1-1.404-.669.058.058 0 0 1-.029-.046.058.058 0 0 1 .023-.05c.094-.07.189-.144.279-.218a.056.056 0 0 1 .058-.008c2.946 1.345 6.135 1.345 9.046 0a.056.056 0 0 1 .059.007c.09.074.184.149.28.22a.058.058 0 0 1 .023.049.059.059 0 0 1-.028.046 9.224 9.224 0 0 1-1.405.669.058.058 0 0 0-.033.033.056.056 0 0 0 .002.047c.27.523.58 1.022.92 1.495a.056.056 0 0 0 .062.021 14.878 14.878 0 0 0 4.502-2.272.055.055 0 0 0 .016-.018.056.056 0 0 0 .008-.023c.375-3.883-.63-7.256-2.662-10.246a.046.046 0 0 0-.023-.021Zm-9.223 8.221c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.717 1.814-1.618 1.814Zm5.981 0c-.887 0-1.618-.814-1.618-1.814s.717-1.814 1.618-1.814c.908 0 1.632.821 1.618 1.814 0 1-.71 1.814-1.618 1.814Z" />
</svg>
)
}
diff --git a/apps/docs/src/components/icons/DocumentIcon.tsx b/apps/docs/src/components/icons/DocumentIcon.tsx
index b576db048..8f83d2094 100644
--- a/apps/docs/src/components/icons/DocumentIcon.tsx
+++ b/apps/docs/src/components/icons/DocumentIcon.tsx
@@ -1,4 +1,4 @@
-export function DocumentIcon(props) {
+export function DocumentIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/EnvelopeIcon.tsx b/apps/docs/src/components/icons/EnvelopeIcon.tsx
index 17ab4fa95..de57e4c47 100644
--- a/apps/docs/src/components/icons/EnvelopeIcon.tsx
+++ b/apps/docs/src/components/icons/EnvelopeIcon.tsx
@@ -1,4 +1,4 @@
-export function EnvelopeIcon(props) {
+export function EnvelopeIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/FaceSmileIcon.tsx b/apps/docs/src/components/icons/FaceSmileIcon.tsx
index 4c01755a3..7c855a63e 100644
--- a/apps/docs/src/components/icons/FaceSmileIcon.tsx
+++ b/apps/docs/src/components/icons/FaceSmileIcon.tsx
@@ -1,4 +1,4 @@
-export function FaceSmileIcon(props) {
+export function FaceSmileIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/FolderIcon.tsx b/apps/docs/src/components/icons/FolderIcon.tsx
index c59b6e0ac..050c77bb7 100644
--- a/apps/docs/src/components/icons/FolderIcon.tsx
+++ b/apps/docs/src/components/icons/FolderIcon.tsx
@@ -1,4 +1,4 @@
-export function FolderIcon(props) {
+export function FolderIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/LinkIcon.tsx b/apps/docs/src/components/icons/LinkIcon.tsx
index 2dace2318..f77d6184a 100644
--- a/apps/docs/src/components/icons/LinkIcon.tsx
+++ b/apps/docs/src/components/icons/LinkIcon.tsx
@@ -1,4 +1,4 @@
-export function LinkIcon(props) {
+export function LinkIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/ListIcon.tsx b/apps/docs/src/components/icons/ListIcon.tsx
index ea45c0a6d..69354ec06 100644
--- a/apps/docs/src/components/icons/ListIcon.tsx
+++ b/apps/docs/src/components/icons/ListIcon.tsx
@@ -1,4 +1,4 @@
-export function ListIcon(props) {
+export function ListIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/MagnifyingGlassIcon.tsx b/apps/docs/src/components/icons/MagnifyingGlassIcon.tsx
index 309359c29..f7d229482 100644
--- a/apps/docs/src/components/icons/MagnifyingGlassIcon.tsx
+++ b/apps/docs/src/components/icons/MagnifyingGlassIcon.tsx
@@ -1,4 +1,6 @@
-export function MagnifyingGlassIcon(props) {
+export function MagnifyingGlassIcon(
+ props: React.ComponentPropsWithoutRef<'svg'>
+) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path strokeWidth="0" d="M2.5 8.5a6 6 0 1 1 12 0 6 6 0 0 1-12 0Z" />
diff --git a/apps/docs/src/components/icons/MapPinIcon.tsx b/apps/docs/src/components/icons/MapPinIcon.tsx
index b581a6d68..6070adb13 100644
--- a/apps/docs/src/components/icons/MapPinIcon.tsx
+++ b/apps/docs/src/components/icons/MapPinIcon.tsx
@@ -1,4 +1,4 @@
-export function MapPinIcon(props) {
+export function MapPinIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/PackageIcon.tsx b/apps/docs/src/components/icons/PackageIcon.tsx
index cb0bc98d2..6bd9225f5 100644
--- a/apps/docs/src/components/icons/PackageIcon.tsx
+++ b/apps/docs/src/components/icons/PackageIcon.tsx
@@ -1,4 +1,4 @@
-export function PackageIcon(props) {
+export function PackageIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/PaperAirplaneIcon.tsx b/apps/docs/src/components/icons/PaperAirplaneIcon.tsx
index 6f96ea84b..2c93f5bc3 100644
--- a/apps/docs/src/components/icons/PaperAirplaneIcon.tsx
+++ b/apps/docs/src/components/icons/PaperAirplaneIcon.tsx
@@ -1,4 +1,6 @@
-export function PaperAirplaneIcon(props) {
+export function PaperAirplaneIcon(
+ props: React.ComponentPropsWithoutRef<'svg'>
+) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/PaperClipIcon.tsx b/apps/docs/src/components/icons/PaperClipIcon.tsx
index cdd72437a..db51c7f70 100644
--- a/apps/docs/src/components/icons/PaperClipIcon.tsx
+++ b/apps/docs/src/components/icons/PaperClipIcon.tsx
@@ -1,4 +1,4 @@
-export function PaperClipIcon(props) {
+export function PaperClipIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/ShapesIcon.tsx b/apps/docs/src/components/icons/ShapesIcon.tsx
index 5dd29fd0d..ac57a52ca 100644
--- a/apps/docs/src/components/icons/ShapesIcon.tsx
+++ b/apps/docs/src/components/icons/ShapesIcon.tsx
@@ -1,4 +1,4 @@
-export function ShapesIcon(props) {
+export function ShapesIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/ShirtIcon.tsx b/apps/docs/src/components/icons/ShirtIcon.tsx
index 30c67b920..f8cdfd508 100644
--- a/apps/docs/src/components/icons/ShirtIcon.tsx
+++ b/apps/docs/src/components/icons/ShirtIcon.tsx
@@ -1,4 +1,4 @@
-export function ShirtIcon(props) {
+export function ShirtIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/SquaresPlusIcon.tsx b/apps/docs/src/components/icons/SquaresPlusIcon.tsx
index 39a507a4e..0005f59d5 100644
--- a/apps/docs/src/components/icons/SquaresPlusIcon.tsx
+++ b/apps/docs/src/components/icons/SquaresPlusIcon.tsx
@@ -1,4 +1,4 @@
-export function SquaresPlusIcon(props) {
+export function SquaresPlusIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/TagIcon.tsx b/apps/docs/src/components/icons/TagIcon.tsx
index c7e57b038..f36024143 100644
--- a/apps/docs/src/components/icons/TagIcon.tsx
+++ b/apps/docs/src/components/icons/TagIcon.tsx
@@ -1,4 +1,4 @@
-export function TagIcon(props) {
+export function TagIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/UserIcon.tsx b/apps/docs/src/components/icons/UserIcon.tsx
index 350e3c42d..78bb8f617 100644
--- a/apps/docs/src/components/icons/UserIcon.tsx
+++ b/apps/docs/src/components/icons/UserIcon.tsx
@@ -1,4 +1,4 @@
-export function UserIcon(props) {
+export function UserIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/icons/UsersIcon.tsx b/apps/docs/src/components/icons/UsersIcon.tsx
index 68ef13120..aa7d13b3d 100644
--- a/apps/docs/src/components/icons/UsersIcon.tsx
+++ b/apps/docs/src/components/icons/UsersIcon.tsx
@@ -1,4 +1,4 @@
-export function UsersIcon(props) {
+export function UsersIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
<path
diff --git a/apps/docs/src/components/mdx.tsx b/apps/docs/src/components/mdx.tsx
index 379079fd9..f38a366f4 100644
--- a/apps/docs/src/components/mdx.tsx
+++ b/apps/docs/src/components/mdx.tsx
@@ -9,7 +9,7 @@ export const a = Link
export { Button } from '@/components/Button'
export { CodeGroup, Code as code, Pre as pre } from '@/components/Code'
-export function wrapper({ children }) {
+export function wrapper({ children }: { children: React.ReactNode }) {
return (
<article className="flex h-full flex-col pb-10 pt-16">
<Prose className="flex-auto">{children}</Prose>
@@ -20,11 +20,13 @@ export function wrapper({ children }) {
)
}
-export const h2 = function H2(props) {
+export const h2 = function H2(
+ props: Omit<React.ComponentPropsWithoutRef<typeof Heading>, 'level'>
+) {
return <Heading level={2} {...props} />
}
-function InfoIcon(props) {
+function InfoIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
return (
<svg viewBox="0 0 16 16" aria-hidden="true" {...props}>
<circle cx="8" cy="8" r="8" strokeWidth="0" />
@@ -40,7 +42,7 @@ function InfoIcon(props) {
)
}
-export function Note({ children }) {
+export function Note({ children }: { children: React.ReactNode }) {
return (
<div className="my-6 flex gap-2.5 rounded-2xl border border-emerald-500/20 bg-emerald-50/50 p-4 leading-6 text-emerald-900 dark:border-emerald-500/30 dark:bg-emerald-500/5 dark:text-emerald-200 dark:[--tw-prose-links-hover:theme(colors.emerald.300)] dark:[--tw-prose-links:theme(colors.white)]">
<InfoIcon className="mt-1 h-4 w-4 flex-none fill-emerald-500 stroke-white dark:fill-emerald-200/20 dark:stroke-emerald-200" />
@@ -51,7 +53,7 @@ export function Note({ children }) {
)
}
-export function Row({ children }) {
+export function Row({ children }: { children: React.ReactNode }) {
return (
<div className="grid grid-cols-1 items-start gap-x-16 gap-y-10 xl:max-w-none xl:grid-cols-2">
{children}
@@ -59,7 +61,13 @@ export function Row({ children }) {
)
}
-export function Col({ children, sticky = false }) {
+export function Col({
+ children,
+ sticky = false,
+}: {
+ children: React.ReactNode
+ sticky?: boolean
+}) {
return (
<div
className={clsx(
@@ -72,7 +80,7 @@ export function Col({ children, sticky = false }) {
)
}
-export function Properties({ children }) {
+export function Properties({ children }: { children: React.ReactNode }) {
return (
<div className="my-6">
<ul
@@ -85,7 +93,15 @@ export function Properties({ children }) {
)
}
-export function Property({ name, type, children }) {
+export function Property({
+ name,
+ children,
+ type,
+}: {
+ name: string
+ children: React.ReactNode
+ type?: string
+}) {
return (
<li className="m-0 px-0 py-4 first:pt-0 last:pb-0">
<dl className="m-0 flex flex-wrap items-center gap-x-3 gap-y-2">
@@ -93,10 +109,14 @@ export function Property({ name, type, children }) {
<dd>
<code>{name}</code>
</dd>
- <dt className="sr-only">Type</dt>
- <dd className="font-mono text-xs text-zinc-400 dark:text-zinc-500">
- {type}
- </dd>
+ {type && (
+ <>
+ <dt className="sr-only">Type</dt>
+ <dd className="font-mono text-xs text-zinc-400 dark:text-zinc-500">
+ {type}
+ </dd>
+ </>
+ )}
<dt className="sr-only">Description</dt>
<dd className="w-full flex-none [&>:first-child]:mt-0 [&>:last-child]:mb-0">
{children}
diff --git a/apps/docs/src/lib/remToPx.ts b/apps/docs/src/lib/remToPx.ts
index 9ae9628d6..d3c3953a1 100644
--- a/apps/docs/src/lib/remToPx.ts
+++ b/apps/docs/src/lib/remToPx.ts
@@ -1,8 +1,8 @@
-export function remToPx(remValue) {
+export function remToPx(remValue: number) {
let rootFontSize =
typeof window === 'undefined'
? 16
: parseFloat(window.getComputedStyle(document.documentElement).fontSize)
- return parseFloat(remValue) * rootFontSize
+ return remValue * rootFontSize
}
diff --git a/apps/docs/src/mdx/remark.mjs b/apps/docs/src/mdx/remark.mjs
index 15603e9fc..2e1b6a758 100644
--- a/apps/docs/src/mdx/remark.mjs
+++ b/apps/docs/src/mdx/remark.mjs
@@ -7,7 +7,6 @@ import JSON5 from 'json5'
function loadFileSnippet() {
return async (tree) => {
-
const fileLoadingPromises = []
visit(tree, 'code', (node, _nodeIndex, parentNode) => {
@@ -20,16 +19,19 @@ function loadFileSnippet() {
const snippetFileName = annotation.snippet
if (snippet && node.value) {
- throw new Error(`Snippet that should be loaded from file "${snippetFileName}" has content in the markdown file already specified. Please remove the content from the markdown file."`)
+ throw new Error(
+ `Snippet that should be loaded from file "${snippetFileName}" has content in the markdown file already specified. Please remove the content from the markdown file."`
+ )
}
- if (snippet && node.value === "") {
- fileLoadingPromises.push((async () => {
- const file = path.resolve(`./src/code/${snippetFileName}`)
- const content = await readFile(file, 'utf8')
- node.value = content
- })())
-
+ if (snippet && node.value === '') {
+ fileLoadingPromises.push(
+ (async () => {
+ const file = path.resolve(`./src/code/${snippetFileName}`)
+ const content = await readFile(file, 'utf8')
+ node.value = content
+ })()
+ )
}
})
@@ -37,8 +39,4 @@ function loadFileSnippet() {
}
}
-export const remarkPlugins = [
- mdxAnnotations.remark,
- remarkGfm,
- loadFileSnippet,
-]
+export const remarkPlugins = [mdxAnnotations.remark, remarkGfm, loadFileSnippet]
diff --git a/apps/docs/src/utils/useExpiringState.ts b/apps/docs/src/utils/useExpiringState.ts
index b4299d7e5..52145c635 100644
--- a/apps/docs/src/utils/useExpiringState.ts
+++ b/apps/docs/src/utils/useExpiringState.ts
@@ -1,5 +1,5 @@
-import debounce from "lodash.debounce"
-import { useCallback, useMemo, useState } from "react"
+import debounce from 'lodash.debounce'
+import { useCallback, useMemo, useState } from 'react'
function useExpiringState({ defaultValue, timeout }) {
const [value, setValue] = useState(defaultValue)
@@ -13,14 +13,14 @@ function useExpiringState({ defaultValue, timeout }) {
timeout,
{
leading: false,
- trailing: true
+ trailing: true,
}
),
[timeout, defaultValue]
)
const set = useCallback(
- newValue => {
+ (newValue) => {
setValue(newValue)
enqueExpiration()
},
diff --git a/apps/docs/src/utils/usePostHog.tsx b/apps/docs/src/utils/usePostHog.tsx
index be4c77ecf..37ecee646 100644
--- a/apps/docs/src/utils/usePostHog.tsx
+++ b/apps/docs/src/utils/usePostHog.tsx
@@ -2,16 +2,17 @@
import { PostHogProvider as OriginalPostHogProvider } from 'posthog-js/react'
import posthog from 'posthog-js'
-import { usePathname, useSearchParams } from 'next/navigation';
-import { useEffect } from 'react';
-import { useUser } from "./useUser"
+import { usePathname, useSearchParams } from 'next/navigation'
+import { useEffect } from 'react'
+import { useUser } from './useUser'
export function maybeInit() {
- if (typeof window === 'undefined' || !process.env.NEXT_PUBLIC_POSTHOG_KEY) return
+ if (typeof window === 'undefined' || !process.env.NEXT_PUBLIC_POSTHOG_KEY)
+ return
posthog?.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
// Note that PostHog will automatically capture page views and common events
- api_host: `${window.location.protocol}//${window.location.host}/ingest`, // BEWARE: basePath "docs" is needed
+ api_host: `/docs/ingest`, // BEWARE: basePath "docs" is needed
disable_session_recording: process.env.NODE_ENV !== 'production',
advanced_disable_toolbar_metrics: true,
opt_in_site_apps: true,
@@ -19,7 +20,7 @@ export function maybeInit() {
loaded: (posthog) => {
// console.log('PostHog loaded', process.env.NODE_ENV)
if (process.env.NODE_ENV === 'development') posthog.debug()
- }
+ },
})
}
@@ -28,34 +29,33 @@ maybeInit()
// Based on https://posthog.com/tutorials/nextjs-app-directory-analytics
export function PostHogProvider({ children }) {
return (
- <OriginalPostHogProvider client={process.env.NEXT_PUBLIC_POSTHOG_KEY ? posthog : undefined}>
+ <OriginalPostHogProvider
+ client={process.env.NEXT_PUBLIC_POSTHOG_KEY ? posthog : undefined}
+ >
{children}
</OriginalPostHogProvider>
)
}
export function PostHogAnalytics() {
- const pathname = usePathname();
- const searchParams = useSearchParams();
- const { user } = useUser();
- const defaultTeamId = user?.teams?.[0]?.team_id;
+ const pathname = usePathname()
+ const searchParams = useSearchParams()
+ const { user } = useUser()
+ const defaultTeamId = user?.teams?.[0]?.team_id
useEffect(() => {
if (pathname) {
let url = window.origin + pathname
if (searchParams.toString()) url = url + `?${searchParams.toString()}`
- posthog?.capture(
- '$pageview',
- { '$current_url': url }
- )
+ posthog?.capture('$pageview', { $current_url: url })
}
}, [pathname, searchParams])
-
+
useEffect(() => {
if (user) {
posthog?.identify(user.id, { email: user.email })
posthog?.group('team', defaultTeamId, { name: user?.teams?.[0]?.name })
}
- }, [user])
-
+ }, [user, defaultTeamId])
+
return null
}
diff --git a/apps/docs/src/utils/useUser.tsx b/apps/docs/src/utils/useUser.tsx
index bb055ec19..5ab487c03 100644
--- a/apps/docs/src/utils/useUser.tsx
+++ b/apps/docs/src/utils/useUser.tsx
@@ -1,70 +1,77 @@
'use client'
-import { useEffect, useState, createContext, useContext, useMemo } from 'react';
-import { User } from '@supabase/supabase-auth-helpers/react';
-import { createPagesBrowserClient } from '@supabase/auth-helpers-nextjs';
-import * as Sentry from "@sentry/nextjs";
-
-/**
- * @typedef {Object} UserContextType
- * @property {boolean} isLoading
- * @property {Session|null} session
- * @property {User|null} user
- * @property {Error|null} error
- */
-export const UserContext = createContext(undefined);
+import { useEffect, useState, createContext, useContext, useMemo, useRef } from 'react'
+import { User } from '@supabase/supabase-auth-helpers/react'
+import { createPagesBrowserClient } from '@supabase/auth-helpers-nextjs'
+import { type Session } from '@supabase/supabase-js'
+import * as Sentry from '@sentry/nextjs'
+
+type UserContextType = {
+ isLoading: boolean
+ session: Session | null
+ user: User & { teams: any[]; apiKeys: any[] } | null
+ error: Error | null
+}
+
+export const UserContext = createContext(undefined)
export const CustomUserContextProvider = (props) => {
- const supabase = createPagesBrowserClient();
- const [session, setSession] = useState(null);
- const [user, setUser] = useState(null);
- const [error, setError] = useState(null);
- const [isLoading, setIsLoading] = useState(true);
-
- let mounted;
-
+ const supabase = createPagesBrowserClient()
+ const [session, setSession] = useState(null)
+ const [user, setUser] = useState(null)
+ const [error, setError] = useState(null)
+ const [isLoading, setIsLoading] = useState(true)
+ const mounted = useRef<boolean>(false)
+
useEffect(() => {
- mounted = true;
+ mounted.current = true
async function getSession() {
const {
data: { session },
- error
- } = await supabase.auth.getSession();
+ error,
+ } = await supabase.auth.getSession()
- if (mounted) {
+ if (mounted.current) {
if (error) {
- setError(error);
- setIsLoading(false);
- return;
+ setError(error)
+ setIsLoading(false)
+ return
}
- setSession(session);
- if (!session) setIsLoading(false); // if session is present, we set setLoading to false in the second useEffect
+ setSession(session)
+ if (!session) setIsLoading(false) // if session is present, we set setLoading to false in the second useEffect
}
}
- void getSession();
+ void getSession()
return () => {
- mounted = false;
- };
- }, []);
+ mounted.current = false
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [])
useEffect(() => {
const {
- data: { subscription }
+ data: { subscription },
} = supabase.auth.onAuthStateChange((event, session) => {
- if (session && (event === 'SIGNED_IN' || event === 'TOKEN_REFRESHED' || event === 'USER_UPDATED')) {
- setSession(session);
+ if (
+ session &&
+ (event === 'SIGNED_IN' ||
+ event === 'TOKEN_REFRESHED' ||
+ event === 'USER_UPDATED')
+ ) {
+ setSession(session)
}
if (event === 'SIGNED_OUT') {
- setSession(null);
+ setSession(null)
}
- });
+ })
return () => {
- subscription.unsubscribe();
- };
- }, []);
-
+ subscription.unsubscribe()
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [])
+
useEffect(() => {
async function getUserCustom() {
// @ts-ignore
@@ -72,34 +79,37 @@ export const CustomUserContextProvider = (props) => {
.from('users_teams')
.select('*')
.eq('user_id', session?.user.id) // Due to RLS, we could also safely just fetch all, but let's be explicit for sure
- if (teamsError) Sentry.captureException(teamsError);
-
+ if (teamsError) Sentry.captureException(teamsError)
+
const { data: apiKeys, error: apiKeysError } = await supabase
.from('team_api_keys')
.select('*')
- .in('team_id', teams?.map(team => team.team_id)) // Due to RLS, we could also safely just fetch all, but let's be explicit for sure
- if (apiKeysError) Sentry.captureException(apiKeysError);
-
+ .in(
+ 'team_id',
+ teams?.map((team) => team.team_id)
+ ) // Due to RLS, we could also safely just fetch all, but let's be explicit for sure
+ if (apiKeysError) Sentry.captureException(apiKeysError)
+
setUser({
...session?.user,
teams,
apiKeys,
- error: teamsError || apiKeysError
+ error: teamsError || apiKeysError,
})
- setIsLoading(false);
+ setIsLoading(false)
}
- if (session) void getUserCustom();
+ if (session) void getUserCustom()
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [session])
- /** @type {UserContextType} */
- const value = useMemo(() => {
+ const value: UserContextType = useMemo(() => {
if (isLoading) {
return {
isLoading: true,
error: null,
session: null,
user: null,
- };
+ }
}
if (error) {
@@ -108,7 +118,7 @@ export const CustomUserContextProvider = (props) => {
error,
session: null,
user: null,
- };
+ }
}
return {
@@ -116,25 +126,20 @@ export const CustomUserContextProvider = (props) => {
error: null,
session,
user,
- };
- }, [isLoading, user, session, error]);
-
- return <UserContext.Provider value={value} {...props} />;
-};
-
-/**
- * @returns {UserContextType} user
- */
-export const useUser = () => {
- const context = useContext(UserContext);
- if (context === undefined) throw new Error(`useUser must be used within a CustomUserContextProvider.`);
- return context;
-};
-
-/**
- * @returns {string} apiKey
- */
-export const useApiKey = () => {
- const { user } = useUser();
- return user?.apiKeys?.[0]?.api_key;
+ }
+ }, [isLoading, user, session, error])
+
+ return <UserContext.Provider value={value} {...props} />
+}
+
+export const useUser = (): UserContextType => {
+ const context = useContext(UserContext)
+ if (context === undefined)
+ throw new Error(`useUser must be used within a CustomUserContextProvider.`)
+ return context
+}
+
+export const useApiKey = (): string => {
+ const { user } = useUser()
+ return user?.apiKeys?.[0]?.api_key
}
diff --git a/apps/docs/tailwind.config.js b/apps/docs/tailwind.config.ts
similarity index 74%
rename from apps/docs/tailwind.config.js
rename to apps/docs/tailwind.config.ts
index b9136a39f..42ac3fe52 100644
--- a/apps/docs/tailwind.config.js
+++ b/apps/docs/tailwind.config.ts
@@ -1,6 +1,10 @@
-/** @type {import('tailwindcss').Config} */
-module.exports = {
- content: ['./src/**/*.{js,ts,mjs,jsx,tsx,mdx}'],
+import { type Config } from 'tailwindcss'
+import typographyStyles from './typography'
+import typographyPlugin from '@tailwindcss/typography'
+import headlessuiPlugin from '@headlessui/tailwindcss'
+
+export default {
+ content: ['./src/**/*.{js,mjs,jsx,ts,tsx,mdx}'],
darkMode: 'class',
theme: {
fontSize: {
@@ -19,7 +23,7 @@ module.exports = {
'8xl': ['6rem', { lineHeight: '1' }],
'9xl': ['8rem', { lineHeight: '1' }],
},
- typography: require('./typography'),
+ typography: typographyStyles,
extend: {
boxShadow: {
glow: '0 0 4px rgb(0 0 0 / 0.1)',
@@ -38,8 +42,5 @@ module.exports = {
},
},
},
- plugins: [
- require('@tailwindcss/typography'),
- require('@headlessui/tailwindcss'),
- ],
-}
+ plugins: [typographyPlugin, headlessuiPlugin],
+} satisfies Config
diff --git a/apps/docs/tsconfig.json b/apps/docs/tsconfig.json
index f0181ec62..00c895324 100644
--- a/apps/docs/tsconfig.json
+++ b/apps/docs/tsconfig.json
@@ -23,10 +23,6 @@
"@/*": ["./src/*"]
}
},
- "include": [
- "next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
- "exclude": [
- "node_modules",
- "src/code"
- ]
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
+ "exclude": ["node_modules", "src/code"]
}
diff --git a/apps/docs/types.d.ts b/apps/docs/types.d.ts
new file mode 100644
index 000000000..2a2370723
--- /dev/null
+++ b/apps/docs/types.d.ts
@@ -0,0 +1,11 @@
+import { type SearchOptions } from 'flexsearch'
+
+declare module '@/mdx/search.mjs' {
+ export type Result = {
+ url: string
+ title: string
+ pageTitle?: string
+ }
+
+ export function search(query: string, options?: SearchOptions): Array<Result>
+}
diff --git a/apps/docs/typestat.json b/apps/docs/typestat.json
index 402e7db59..7f41eb149 100644
--- a/apps/docs/typestat.json
+++ b/apps/docs/typestat.json
@@ -1,17 +1,15 @@
{
- "files": {
- "renameExtensions": true
- },
- "fixes": {
- "incompleteTypes": true,
- "missingProperties": true,
- "noImplicitAny": true
- },
- "cleanups": {
- "suppressTypeErrors": true
- },
- "include": [
- "src/**/*.{js,jsx}"
- ],
- "project": "./tsconfig.json"
-}
\ No newline at end of file
+ "files": {
+ "renameExtensions": true
+ },
+ "fixes": {
+ "incompleteTypes": true,
+ "missingProperties": true,
+ "noImplicitAny": true
+ },
+ "cleanups": {
+ "suppressTypeErrors": true
+ },
+ "include": ["src/**/*.{js,jsx}"],
+ "project": "./tsconfig.json"
+}
diff --git a/apps/docs/typography.js b/apps/docs/typography.js
deleted file mode 100644
index 706e456dd..000000000
--- a/apps/docs/typography.js
+++ /dev/null
@@ -1,357 +0,0 @@
-module.exports = ({ theme }) => ({
- DEFAULT: {
- css: {
- '--tw-prose-body': theme('colors.zinc.700'),
- '--tw-prose-headings': theme('colors.zinc.900'),
- '--tw-prose-links': theme('colors.emerald.500'),
- '--tw-prose-links-hover': theme('colors.emerald.600'),
- '--tw-prose-links-underline': theme('colors.emerald.500 / 0.3'),
- '--tw-prose-bold': theme('colors.zinc.900'),
- '--tw-prose-counters': theme('colors.zinc.500'),
- '--tw-prose-bullets': theme('colors.zinc.300'),
- '--tw-prose-hr': theme('colors.zinc.900 / 0.05'),
- '--tw-prose-quotes': theme('colors.zinc.900'),
- '--tw-prose-quote-borders': theme('colors.zinc.200'),
- '--tw-prose-captions': theme('colors.zinc.500'),
- '--tw-prose-code': theme('colors.zinc.900'),
- '--tw-prose-code-bg': theme('colors.zinc.100'),
- '--tw-prose-code-ring': theme('colors.zinc.300'),
- '--tw-prose-th-borders': theme('colors.zinc.300'),
- '--tw-prose-td-borders': theme('colors.zinc.200'),
-
- '--tw-prose-invert-body': theme('colors.zinc.400'),
- '--tw-prose-invert-headings': theme('colors.white'),
- '--tw-prose-invert-links': theme('colors.emerald.400'),
- '--tw-prose-invert-links-hover': theme('colors.emerald.500'),
- '--tw-prose-invert-links-underline': theme('colors.emerald.500 / 0.3'),
- '--tw-prose-invert-bold': theme('colors.white'),
- '--tw-prose-invert-counters': theme('colors.zinc.400'),
- '--tw-prose-invert-bullets': theme('colors.zinc.600'),
- '--tw-prose-invert-hr': theme('colors.white / 0.05'),
- '--tw-prose-invert-quotes': theme('colors.zinc.100'),
- '--tw-prose-invert-quote-borders': theme('colors.zinc.700'),
- '--tw-prose-invert-captions': theme('colors.zinc.400'),
- '--tw-prose-invert-code': theme('colors.white'),
- '--tw-prose-invert-code-bg': theme('colors.zinc.700 / 0.15'),
- '--tw-prose-invert-code-ring': theme('colors.white / 0.1'),
- '--tw-prose-invert-th-borders': theme('colors.zinc.600'),
- '--tw-prose-invert-td-borders': theme('colors.zinc.700'),
-
- // Base
- color: 'var(--tw-prose-body)',
- fontSize: theme('fontSize.sm')[0],
- lineHeight: theme('lineHeight.7'),
-
- // Layout
- '> *': {
- maxWidth: theme('maxWidth.2xl'),
- marginLeft: 'auto',
- marginRight: 'auto',
- '@screen lg': {
- maxWidth: theme('maxWidth.3xl'),
- marginLeft: `calc(50% - min(50%, ${theme('maxWidth.lg')}))`,
- marginRight: `calc(50% - min(50%, ${theme('maxWidth.lg')}))`,
- },
- },
-
- // Text
- p: {
- marginTop: theme('spacing.6'),
- marginBottom: theme('spacing.6'),
- },
- '[class~="lead"]': {
- fontSize: theme('fontSize.base')[0],
- ...theme('fontSize.base')[1],
- },
-
- // Lists
- ol: {
- listStyleType: 'decimal',
- marginTop: theme('spacing.5'),
- marginBottom: theme('spacing.5'),
- paddingLeft: '1.625rem',
- },
- 'ol[type="A"]': {
- listStyleType: 'upper-alpha',
- },
- 'ol[type="a"]': {
- listStyleType: 'lower-alpha',
- },
- 'ol[type="A" s]': {
- listStyleType: 'upper-alpha',
- },
- 'ol[type="a" s]': {
- listStyleType: 'lower-alpha',
- },
- 'ol[type="I"]': {
- listStyleType: 'upper-roman',
- },
- 'ol[type="i"]': {
- listStyleType: 'lower-roman',
- },
- 'ol[type="I" s]': {
- listStyleType: 'upper-roman',
- },
- 'ol[type="i" s]': {
- listStyleType: 'lower-roman',
- },
- 'ol[type="1"]': {
- listStyleType: 'decimal',
- },
- ul: {
- listStyleType: 'disc',
- marginTop: theme('spacing.5'),
- marginBottom: theme('spacing.5'),
- paddingLeft: '1.625rem',
- },
- li: {
- marginTop: theme('spacing.2'),
- marginBottom: theme('spacing.2'),
- },
- ':is(ol, ul) > li': {
- paddingLeft: theme('spacing[1.5]'),
- },
- 'ol > li::marker': {
- fontWeight: '400',
- color: 'var(--tw-prose-counters)',
- },
- 'ul > li::marker': {
- color: 'var(--tw-prose-bullets)',
- },
- '> ul > li p': {
- marginTop: theme('spacing.3'),
- marginBottom: theme('spacing.3'),
- },
- '> ul > li > *:first-child': {
- marginTop: theme('spacing.5'),
- },
- '> ul > li > *:last-child': {
- marginBottom: theme('spacing.5'),
- },
- '> ol > li > *:first-child': {
- marginTop: theme('spacing.5'),
- },
- '> ol > li > *:last-child': {
- marginBottom: theme('spacing.5'),
- },
- 'ul ul, ul ol, ol ul, ol ol': {
- marginTop: theme('spacing.3'),
- marginBottom: theme('spacing.3'),
- },
-
- // Horizontal rules
- hr: {
- borderColor: 'var(--tw-prose-hr)',
- borderTopWidth: 1,
- marginTop: theme('spacing.16'),
- marginBottom: theme('spacing.16'),
- maxWidth: 'none',
- marginLeft: `calc(-1 * ${theme('spacing.4')})`,
- marginRight: `calc(-1 * ${theme('spacing.4')})`,
- '@screen sm': {
- marginLeft: `calc(-1 * ${theme('spacing.6')})`,
- marginRight: `calc(-1 * ${theme('spacing.6')})`,
- },
- '@screen lg': {
- marginLeft: `calc(-1 * ${theme('spacing.8')})`,
- marginRight: `calc(-1 * ${theme('spacing.8')})`,
- },
- },
-
- // Quotes
- blockquote: {
- fontWeight: '500',
- fontStyle: 'italic',
- color: 'var(--tw-prose-quotes)',
- borderLeftWidth: '0.25rem',
- borderLeftColor: 'var(--tw-prose-quote-borders)',
- quotes: '"\\201C""\\201D""\\2018""\\2019"',
- marginTop: theme('spacing.8'),
- marginBottom: theme('spacing.8'),
- paddingLeft: theme('spacing.5'),
- },
- 'blockquote p:first-of-type::before': {
- content: 'open-quote',
- },
- 'blockquote p:last-of-type::after': {
- content: 'close-quote',
- },
-
- // Headings
- h1: {
- color: 'var(--tw-prose-headings)',
- fontWeight: '700',
- fontSize: theme('fontSize.2xl')[0],
- ...theme('fontSize.2xl')[1],
- marginBottom: theme('spacing.2'),
- },
- h2: {
- color: 'var(--tw-prose-headings)',
- fontWeight: '600',
- fontSize: theme('fontSize.lg')[0],
- ...theme('fontSize.lg')[1],
- marginTop: theme('spacing.16'),
- marginBottom: theme('spacing.2'),
- },
- h3: {
- color: 'var(--tw-prose-headings)',
- fontSize: theme('fontSize.base')[0],
- ...theme('fontSize.base')[1],
- fontWeight: '600',
- marginTop: theme('spacing.10'),
- marginBottom: theme('spacing.2'),
- },
-
- // Media
- 'img, video, figure': {
- marginTop: theme('spacing.8'),
- marginBottom: theme('spacing.8'),
- },
- 'figure > *': {
- marginTop: '0',
- marginBottom: '0',
- },
- figcaption: {
- color: 'var(--tw-prose-captions)',
- fontSize: theme('fontSize.xs')[0],
- ...theme('fontSize.xs')[1],
- marginTop: theme('spacing.2'),
- },
-
- // Tables
- table: {
- width: '100%',
- tableLayout: 'auto',
- textAlign: 'left',
- marginTop: theme('spacing.8'),
- marginBottom: theme('spacing.8'),
- lineHeight: theme('lineHeight.6'),
- },
- thead: {
- borderBottomWidth: '1px',
- borderBottomColor: 'var(--tw-prose-th-borders)',
- },
- 'thead th': {
- color: 'var(--tw-prose-headings)',
- fontWeight: '600',
- verticalAlign: 'bottom',
- paddingRight: theme('spacing.2'),
- paddingBottom: theme('spacing.2'),
- paddingLeft: theme('spacing.2'),
- },
- 'thead th:first-child': {
- paddingLeft: '0',
- },
- 'thead th:last-child': {
- paddingRight: '0',
- },
- 'tbody tr': {
- borderBottomWidth: '1px',
- borderBottomColor: 'var(--tw-prose-td-borders)',
- },
- 'tbody tr:last-child': {
- borderBottomWidth: '0',
- },
- 'tbody td': {
- verticalAlign: 'baseline',
- },
- tfoot: {
- borderTopWidth: '1px',
- borderTopColor: 'var(--tw-prose-th-borders)',
- },
- 'tfoot td': {
- verticalAlign: 'top',
- },
- ':is(tbody, tfoot) td': {
- paddingTop: theme('spacing.2'),
- paddingRight: theme('spacing.2'),
- paddingBottom: theme('spacing.2'),
- paddingLeft: theme('spacing.2'),
- },
- ':is(tbody, tfoot) td:first-child': {
- paddingLeft: '0',
- },
- ':is(tbody, tfoot) td:last-child': {
- paddingRight: '0',
- },
-
- // Inline elements
- a: {
- color: 'var(--tw-prose-links)',
- textDecoration: 'underline transparent',
- fontWeight: '500',
- transitionProperty: 'color, text-decoration-color',
- transitionDuration: theme('transitionDuration.DEFAULT'),
- transitionTimingFunction: theme('transitionTimingFunction.DEFAULT'),
- '&:hover': {
- color: 'var(--tw-prose-links-hover)',
- textDecorationColor: 'var(--tw-prose-links-underline)',
- },
- },
- ':is(h1, h2, h3) a': {
- fontWeight: 'inherit',
- },
- strong: {
- color: 'var(--tw-prose-bold)',
- fontWeight: '600',
- },
- ':is(a, blockquote, thead th) strong': {
- color: 'inherit',
- },
- code: {
- color: 'var(--tw-prose-code)',
- borderRadius: theme('borderRadius.lg'),
- paddingTop: theme('padding.1'),
- paddingRight: theme('padding[1.5]'),
- paddingBottom: theme('padding.1'),
- paddingLeft: theme('padding[1.5]'),
- boxShadow: 'inset 0 0 0 1px var(--tw-prose-code-ring)',
- backgroundColor: 'var(--tw-prose-code-bg)',
- fontSize: theme('fontSize.2xs'),
- },
- ':is(a, h1, h2, h3, blockquote, thead th) code': {
- color: 'inherit',
- },
- 'h2 code': {
- fontSize: theme('fontSize.base')[0],
- fontWeight: 'inherit',
- },
- 'h3 code': {
- fontSize: theme('fontSize.sm')[0],
- fontWeight: 'inherit',
- },
-
- // Overrides
- ':is(h1, h2, h3) + *': {
- marginTop: '0',
- },
- '> :first-child': {
- marginTop: '0 !important',
- },
- '> :last-child': {
- marginBottom: '0 !important',
- },
- },
- },
- invert: {
- css: {
- '--tw-prose-body': 'var(--tw-prose-invert-body)',
- '--tw-prose-headings': 'var(--tw-prose-invert-headings)',
- '--tw-prose-links': 'var(--tw-prose-invert-links)',
- '--tw-prose-links-hover': 'var(--tw-prose-invert-links-hover)',
- '--tw-prose-links-underline': 'var(--tw-prose-invert-links-underline)',
- '--tw-prose-bold': 'var(--tw-prose-invert-bold)',
- '--tw-prose-counters': 'var(--tw-prose-invert-counters)',
- '--tw-prose-bullets': 'var(--tw-prose-invert-bullets)',
- '--tw-prose-hr': 'var(--tw-prose-invert-hr)',
- '--tw-prose-quotes': 'var(--tw-prose-invert-quotes)',
- '--tw-prose-quote-borders': 'var(--tw-prose-invert-quote-borders)',
- '--tw-prose-captions': 'var(--tw-prose-invert-captions)',
- '--tw-prose-code': 'var(--tw-prose-invert-code)',
- '--tw-prose-code-bg': 'var(--tw-prose-invert-code-bg)',
- '--tw-prose-code-ring': 'var(--tw-prose-invert-code-ring)',
- '--tw-prose-th-borders': 'var(--tw-prose-invert-th-borders)',
- '--tw-prose-td-borders': 'var(--tw-prose-invert-td-borders)',
- },
- },
-})
diff --git a/apps/docs/typography.ts b/apps/docs/typography.ts
new file mode 100644
index 000000000..c036540f6
--- /dev/null
+++ b/apps/docs/typography.ts
@@ -0,0 +1,361 @@
+import { type PluginUtils } from 'tailwindcss/types/config'
+
+export default function typographyStyles({ theme }: PluginUtils) {
+ return {
+ DEFAULT: {
+ css: {
+ '--tw-prose-body': theme('colors.zinc.700'),
+ '--tw-prose-headings': theme('colors.zinc.900'),
+ '--tw-prose-links': theme('colors.emerald.500'),
+ '--tw-prose-links-hover': theme('colors.emerald.600'),
+ '--tw-prose-links-underline': theme('colors.emerald.500 / 0.3'),
+ '--tw-prose-bold': theme('colors.zinc.900'),
+ '--tw-prose-counters': theme('colors.zinc.500'),
+ '--tw-prose-bullets': theme('colors.zinc.300'),
+ '--tw-prose-hr': theme('colors.zinc.900 / 0.05'),
+ '--tw-prose-quotes': theme('colors.zinc.900'),
+ '--tw-prose-quote-borders': theme('colors.zinc.200'),
+ '--tw-prose-captions': theme('colors.zinc.500'),
+ '--tw-prose-code': theme('colors.zinc.900'),
+ '--tw-prose-code-bg': theme('colors.zinc.100'),
+ '--tw-prose-code-ring': theme('colors.zinc.300'),
+ '--tw-prose-th-borders': theme('colors.zinc.300'),
+ '--tw-prose-td-borders': theme('colors.zinc.200'),
+
+ '--tw-prose-invert-body': theme('colors.zinc.400'),
+ '--tw-prose-invert-headings': theme('colors.white'),
+ '--tw-prose-invert-links': theme('colors.emerald.400'),
+ '--tw-prose-invert-links-hover': theme('colors.emerald.500'),
+ '--tw-prose-invert-links-underline': theme('colors.emerald.500 / 0.3'),
+ '--tw-prose-invert-bold': theme('colors.white'),
+ '--tw-prose-invert-counters': theme('colors.zinc.400'),
+ '--tw-prose-invert-bullets': theme('colors.zinc.600'),
+ '--tw-prose-invert-hr': theme('colors.white / 0.05'),
+ '--tw-prose-invert-quotes': theme('colors.zinc.100'),
+ '--tw-prose-invert-quote-borders': theme('colors.zinc.700'),
+ '--tw-prose-invert-captions': theme('colors.zinc.400'),
+ '--tw-prose-invert-code': theme('colors.white'),
+ '--tw-prose-invert-code-bg': theme('colors.zinc.700 / 0.15'),
+ '--tw-prose-invert-code-ring': theme('colors.white / 0.1'),
+ '--tw-prose-invert-th-borders': theme('colors.zinc.600'),
+ '--tw-prose-invert-td-borders': theme('colors.zinc.700'),
+
+ // Base
+ color: 'var(--tw-prose-body)',
+ fontSize: theme('fontSize.sm')[0],
+ lineHeight: theme('lineHeight.7'),
+
+ // Layout
+ '> *': {
+ maxWidth: theme('maxWidth.2xl'),
+ marginLeft: 'auto',
+ marginRight: 'auto',
+ '@screen lg': {
+ maxWidth: theme('maxWidth.3xl'),
+ marginLeft: `calc(50% - min(50%, ${theme('maxWidth.lg')}))`,
+ marginRight: `calc(50% - min(50%, ${theme('maxWidth.lg')}))`,
+ },
+ },
+
+ // Text
+ p: {
+ marginTop: theme('spacing.6'),
+ marginBottom: theme('spacing.6'),
+ },
+ '[class~="lead"]': {
+ fontSize: theme('fontSize.base')[0],
+ ...theme('fontSize.base')[1],
+ },
+
+ // Lists
+ ol: {
+ listStyleType: 'decimal',
+ marginTop: theme('spacing.5'),
+ marginBottom: theme('spacing.5'),
+ paddingLeft: '1.625rem',
+ },
+ 'ol[type="A"]': {
+ listStyleType: 'upper-alpha',
+ },
+ 'ol[type="a"]': {
+ listStyleType: 'lower-alpha',
+ },
+ 'ol[type="A" s]': {
+ listStyleType: 'upper-alpha',
+ },
+ 'ol[type="a" s]': {
+ listStyleType: 'lower-alpha',
+ },
+ 'ol[type="I"]': {
+ listStyleType: 'upper-roman',
+ },
+ 'ol[type="i"]': {
+ listStyleType: 'lower-roman',
+ },
+ 'ol[type="I" s]': {
+ listStyleType: 'upper-roman',
+ },
+ 'ol[type="i" s]': {
+ listStyleType: 'lower-roman',
+ },
+ 'ol[type="1"]': {
+ listStyleType: 'decimal',
+ },
+ ul: {
+ listStyleType: 'disc',
+ marginTop: theme('spacing.5'),
+ marginBottom: theme('spacing.5'),
+ paddingLeft: '1.625rem',
+ },
+ li: {
+ marginTop: theme('spacing.2'),
+ marginBottom: theme('spacing.2'),
+ },
+ ':is(ol, ul) > li': {
+ paddingLeft: theme('spacing[1.5]'),
+ },
+ 'ol > li::marker': {
+ fontWeight: '400',
+ color: 'var(--tw-prose-counters)',
+ },
+ 'ul > li::marker': {
+ color: 'var(--tw-prose-bullets)',
+ },
+ '> ul > li p': {
+ marginTop: theme('spacing.3'),
+ marginBottom: theme('spacing.3'),
+ },
+ '> ul > li > *:first-child': {
+ marginTop: theme('spacing.5'),
+ },
+ '> ul > li > *:last-child': {
+ marginBottom: theme('spacing.5'),
+ },
+ '> ol > li > *:first-child': {
+ marginTop: theme('spacing.5'),
+ },
+ '> ol > li > *:last-child': {
+ marginBottom: theme('spacing.5'),
+ },
+ 'ul ul, ul ol, ol ul, ol ol': {
+ marginTop: theme('spacing.3'),
+ marginBottom: theme('spacing.3'),
+ },
+
+ // Horizontal rules
+ hr: {
+ borderColor: 'var(--tw-prose-hr)',
+ borderTopWidth: 1,
+ marginTop: theme('spacing.16'),
+ marginBottom: theme('spacing.16'),
+ maxWidth: 'none',
+ marginLeft: `calc(-1 * ${theme('spacing.4')})`,
+ marginRight: `calc(-1 * ${theme('spacing.4')})`,
+ '@screen sm': {
+ marginLeft: `calc(-1 * ${theme('spacing.6')})`,
+ marginRight: `calc(-1 * ${theme('spacing.6')})`,
+ },
+ '@screen lg': {
+ marginLeft: `calc(-1 * ${theme('spacing.8')})`,
+ marginRight: `calc(-1 * ${theme('spacing.8')})`,
+ },
+ },
+
+ // Quotes
+ blockquote: {
+ fontWeight: '500',
+ fontStyle: 'italic',
+ color: 'var(--tw-prose-quotes)',
+ borderLeftWidth: '0.25rem',
+ borderLeftColor: 'var(--tw-prose-quote-borders)',
+ quotes: '"\\201C""\\201D""\\2018""\\2019"',
+ marginTop: theme('spacing.8'),
+ marginBottom: theme('spacing.8'),
+ paddingLeft: theme('spacing.5'),
+ },
+ 'blockquote p:first-of-type::before': {
+ content: 'open-quote',
+ },
+ 'blockquote p:last-of-type::after': {
+ content: 'close-quote',
+ },
+
+ // Headings
+ h1: {
+ color: 'var(--tw-prose-headings)',
+ fontWeight: '700',
+ fontSize: theme('fontSize.2xl')[0],
+ ...theme('fontSize.2xl')[1],
+ marginBottom: theme('spacing.2'),
+ },
+ h2: {
+ color: 'var(--tw-prose-headings)',
+ fontWeight: '600',
+ fontSize: theme('fontSize.lg')[0],
+ ...theme('fontSize.lg')[1],
+ marginTop: theme('spacing.16'),
+ marginBottom: theme('spacing.2'),
+ },
+ h3: {
+ color: 'var(--tw-prose-headings)',
+ fontSize: theme('fontSize.base')[0],
+ ...theme('fontSize.base')[1],
+ fontWeight: '600',
+ marginTop: theme('spacing.10'),
+ marginBottom: theme('spacing.2'),
+ },
+
+ // Media
+ 'img, video, figure': {
+ marginTop: theme('spacing.8'),
+ marginBottom: theme('spacing.8'),
+ },
+ 'figure > *': {
+ marginTop: '0',
+ marginBottom: '0',
+ },
+ figcaption: {
+ color: 'var(--tw-prose-captions)',
+ fontSize: theme('fontSize.xs')[0],
+ ...theme('fontSize.xs')[1],
+ marginTop: theme('spacing.2'),
+ },
+
+ // Tables
+ table: {
+ width: '100%',
+ tableLayout: 'auto',
+ textAlign: 'left',
+ marginTop: theme('spacing.8'),
+ marginBottom: theme('spacing.8'),
+ lineHeight: theme('lineHeight.6'),
+ },
+ thead: {
+ borderBottomWidth: '1px',
+ borderBottomColor: 'var(--tw-prose-th-borders)',
+ },
+ 'thead th': {
+ color: 'var(--tw-prose-headings)',
+ fontWeight: '600',
+ verticalAlign: 'bottom',
+ paddingRight: theme('spacing.2'),
+ paddingBottom: theme('spacing.2'),
+ paddingLeft: theme('spacing.2'),
+ },
+ 'thead th:first-child': {
+ paddingLeft: '0',
+ },
+ 'thead th:last-child': {
+ paddingRight: '0',
+ },
+ 'tbody tr': {
+ borderBottomWidth: '1px',
+ borderBottomColor: 'var(--tw-prose-td-borders)',
+ },
+ 'tbody tr:last-child': {
+ borderBottomWidth: '0',
+ },
+ 'tbody td': {
+ verticalAlign: 'baseline',
+ },
+ tfoot: {
+ borderTopWidth: '1px',
+ borderTopColor: 'var(--tw-prose-th-borders)',
+ },
+ 'tfoot td': {
+ verticalAlign: 'top',
+ },
+ ':is(tbody, tfoot) td': {
+ paddingTop: theme('spacing.2'),
+ paddingRight: theme('spacing.2'),
+ paddingBottom: theme('spacing.2'),
+ paddingLeft: theme('spacing.2'),
+ },
+ ':is(tbody, tfoot) td:first-child': {
+ paddingLeft: '0',
+ },
+ ':is(tbody, tfoot) td:last-child': {
+ paddingRight: '0',
+ },
+
+ // Inline elements
+ a: {
+ color: 'var(--tw-prose-links)',
+ textDecoration: 'underline transparent',
+ fontWeight: '500',
+ transitionProperty: 'color, text-decoration-color',
+ transitionDuration: theme('transitionDuration.DEFAULT'),
+ transitionTimingFunction: theme('transitionTimingFunction.DEFAULT'),
+ '&:hover': {
+ color: 'var(--tw-prose-links-hover)',
+ textDecorationColor: 'var(--tw-prose-links-underline)',
+ },
+ },
+ ':is(h1, h2, h3) a': {
+ fontWeight: 'inherit',
+ },
+ strong: {
+ color: 'var(--tw-prose-bold)',
+ fontWeight: '600',
+ },
+ ':is(a, blockquote, thead th) strong': {
+ color: 'inherit',
+ },
+ code: {
+ color: 'var(--tw-prose-code)',
+ borderRadius: theme('borderRadius.lg'),
+ paddingTop: theme('padding.1'),
+ paddingRight: theme('padding[1.5]'),
+ paddingBottom: theme('padding.1'),
+ paddingLeft: theme('padding[1.5]'),
+ boxShadow: 'inset 0 0 0 1px var(--tw-prose-code-ring)',
+ backgroundColor: 'var(--tw-prose-code-bg)',
+ fontSize: theme('fontSize.2xs'),
+ },
+ ':is(a, h1, h2, h3, blockquote, thead th) code': {
+ color: 'inherit',
+ },
+ 'h2 code': {
+ fontSize: theme('fontSize.base')[0],
+ fontWeight: 'inherit',
+ },
+ 'h3 code': {
+ fontSize: theme('fontSize.sm')[0],
+ fontWeight: 'inherit',
+ },
+
+ // Overrides
+ ':is(h1, h2, h3) + *': {
+ marginTop: '0',
+ },
+ '> :first-child': {
+ marginTop: '0 !important',
+ },
+ '> :last-child': {
+ marginBottom: '0 !important',
+ },
+ },
+ },
+ invert: {
+ css: {
+ '--tw-prose-body': 'var(--tw-prose-invert-body)',
+ '--tw-prose-headings': 'var(--tw-prose-invert-headings)',
+ '--tw-prose-links': 'var(--tw-prose-invert-links)',
+ '--tw-prose-links-hover': 'var(--tw-prose-invert-links-hover)',
+ '--tw-prose-links-underline': 'var(--tw-prose-invert-links-underline)',
+ '--tw-prose-bold': 'var(--tw-prose-invert-bold)',
+ '--tw-prose-counters': 'var(--tw-prose-invert-counters)',
+ '--tw-prose-bullets': 'var(--tw-prose-invert-bullets)',
+ '--tw-prose-hr': 'var(--tw-prose-invert-hr)',
+ '--tw-prose-quotes': 'var(--tw-prose-invert-quotes)',
+ '--tw-prose-quote-borders': 'var(--tw-prose-invert-quote-borders)',
+ '--tw-prose-captions': 'var(--tw-prose-invert-captions)',
+ '--tw-prose-code': 'var(--tw-prose-invert-code)',
+ '--tw-prose-code-bg': 'var(--tw-prose-invert-code-bg)',
+ '--tw-prose-code-ring': 'var(--tw-prose-invert-code-ring)',
+ '--tw-prose-th-borders': 'var(--tw-prose-invert-th-borders)',
+ '--tw-prose-td-borders': 'var(--tw-prose-invert-td-borders)',
+ },
+ },
+ }
+}