Skip to content

Commit c0d6e04

Browse files
merging all conflicts
2 parents f4617fe + 3563d95 commit c0d6e04

File tree

214 files changed

+7654
-2333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+7654
-2333
lines changed

.env.development

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
SANDPACK_BARE_COMPONENTS=true

.env.production

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
NEXT_PUBLIC_GA_TRACKING_ID = 'UA-41298772-4'
2-
SANDPACK_BARE_COMPONENTS=true
1+
NEXT_PUBLIC_GA_TRACKING_ID = 'G-B1E83PJ3RT'

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"plugins": ["@typescript-eslint"],
66
"rules": {
77
"no-unused-vars": "off",
8-
"@typescript-eslint/no-unused-vars": "warn"
8+
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
9+
"react-hooks/exhaustive-deps": "error"
910
},
1011
"env": {
1112
"node": true,

.github/workflows/site_lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v1
1818
- name: Use Node.js 20.x
19-
uses: actions/setup-node@v1
19+
uses: actions/setup-node@v3
2020
with:
2121
node-version: 20.x
2222

2323
- name: Install deps and build (with cache)
24-
uses: bahmutov/npm-install@v1.7.10
24+
uses: bahmutov/npm-install@v1.8.32
2525

2626
- name: Lint codebase
2727
run: yarn ci-check

next.config.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ const nextConfig = {
1414
scrollRestoration: true,
1515
legacyBrowsers: false,
1616
},
17-
env: {
18-
SANDPACK_BARE_COMPONENTS: process.env.SANDPACK_BARE_COMPONENTS,
19-
},
17+
env: {},
2018
webpack: (config, {dev, isServer, ...options}) => {
2119
if (process.env.ANALYZE) {
2220
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
@@ -35,10 +33,6 @@ const nextConfig = {
3533

3634
const {IgnorePlugin, NormalModuleReplacementPlugin} = require('webpack');
3735
config.plugins.push(
38-
new NormalModuleReplacementPlugin(
39-
/^@stitches\/core$/,
40-
require.resolve('./src/utils/emptyShim.js')
41-
),
4236
new NormalModuleReplacementPlugin(
4337
/^raf$/,
4438
require.resolve('./src/utils/rafShim.js')

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,20 @@
2323
"prepare": "husky install"
2424
},
2525
"dependencies": {
26-
"@codesandbox/sandpack-react": "1.15.5",
26+
"@codesandbox/sandpack-react": "2.6.0",
2727
"@docsearch/css": "3.0.0-alpha.41",
2828
"@docsearch/react": "3.0.0-alpha.41",
2929
"@headlessui/react": "^1.7.0",
3030
"body-scroll-lock": "^3.1.3",
3131
"classnames": "^2.2.6",
3232
"date-fns": "^2.16.1",
3333
"debounce": "^1.2.1",
34-
"ga-lite": "^2.1.4",
3534
"github-slugger": "^1.3.0",
3635
"next": "^13.4.1",
3736
"next-remote-watch": "^1.0.0",
3837
"parse-numeric-range": "^1.2.0",
3938
"react": "^0.0.0-experimental-16d053d59-20230506",
40-
"react-collapsed": "npm:@gaearon/[email protected]",
39+
"react-collapsed": "4.0.4",
4140
"react-dom": "^0.0.0-experimental-16d053d59-20230506",
4241
"remark-frontmatter": "^4.0.1",
4342
"remark-gfm": "^3.0.1"
@@ -93,7 +92,7 @@
9392
"retext": "^7.0.1",
9493
"retext-smartypants": "^4.0.0",
9594
"rss": "^1.2.2",
96-
"tailwindcss": "^3.0.22",
95+
"tailwindcss": "^3.4.1",
9796
"typescript": "^4.0.2",
9897
"unist-util-visit": "^2.0.3",
9998
"webpack-bundle-analyzer": "^4.5.0"

patches/@codemirror+lang-javascript+0.19.6.patch

Lines changed: 0 additions & 30 deletions
This file was deleted.

patches/@codesandbox+sandpack-react+1.15.5.patch

Lines changed: 0 additions & 62 deletions
This file was deleted.

patches/@lezer+javascript+0.15.2.patch

Lines changed: 0 additions & 345 deletions
This file was deleted.

plugins/remark-smartypants.js

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*!
2+
* Based on 'silvenon/remark-smartypants'
3+
* https://github.com/silvenon/remark-smartypants/pull/80
4+
*/
5+
16
const visit = require('unist-util-visit');
27
const retext = require('retext');
38
const smartypants = require('retext-smartypants');
@@ -9,12 +14,48 @@ function check(parent) {
914
}
1015

1116
module.exports = function (options) {
12-
const processor = retext().use(smartypants, options);
17+
const processor = retext().use(smartypants, {
18+
...options,
19+
// Do not replace ellipses, dashes, backticks because they change string
20+
// length, and we couldn't guarantee right splice of text in second visit of
21+
// tree
22+
ellipses: false,
23+
dashes: false,
24+
backticks: false,
25+
});
26+
27+
const processor2 = retext().use(smartypants, {
28+
...options,
29+
// Do not replace quotes because they are already replaced in the first
30+
// processor
31+
quotes: false,
32+
});
1333

1434
function transformer(tree) {
15-
visit(tree, 'text', (node, index, parent) => {
16-
if (check(parent)) node.value = String(processor.processSync(node.value));
35+
let allText = '';
36+
let startIndex = 0;
37+
const textOrInlineCodeNodes = [];
38+
39+
visit(tree, ['text', 'inlineCode'], (node, _, parent) => {
40+
if (check(parent)) {
41+
if (node.type === 'text') allText += node.value;
42+
// for the case when inlineCode contains just one part of quote: `foo'bar`
43+
else allText += 'A'.repeat(node.value.length);
44+
textOrInlineCodeNodes.push(node);
45+
}
1746
});
47+
48+
// Concat all text into one string, to properly replace quotes around non-"text" nodes
49+
allText = String(processor.processSync(allText));
50+
51+
for (const node of textOrInlineCodeNodes) {
52+
const endIndex = startIndex + node.value.length;
53+
if (node.type === 'text') {
54+
const processedText = allText.slice(startIndex, endIndex);
55+
node.value = String(processor2.processSync(processedText));
56+
}
57+
startIndex = endIndex;
58+
}
1859
}
1960

2061
return transformer;
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
11.7 KB
Loading
12.3 KB
Loading
Loading
Loading
Loading
Loading

public/images/team/dave-mccabe.jpg

-203 KB
Binary file not shown.

public/images/team/lunaruan.jpg

-150 KB
Binary file not shown.

public/images/team/mengdi-chen.jpg

-106 KB
Binary file not shown.

public/images/team/sean-keegan.jpg

-199 KB
Binary file not shown.

src/components/Breadcrumbs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ function Breadcrumbs({breadcrumbs}: {breadcrumbs: RouteItem[]}) {
1717
<Fragment key={crumb.path}>
1818
<Link
1919
href={crumb.path}
20-
className="text-link dark:text-link-dark text-sm tracking-wide font-bold uppercase mr-1 hover:underline">
20+
className="text-link dark:text-link-dark text-sm tracking-wide font-bold uppercase me-1 hover:underline">
2121
{crumb.title}
2222
</Link>
23-
<span className="inline-block mr-1 text-link dark:text-link-dark text-lg">
23+
<span className="inline-block me-1 text-link dark:text-link-dark text-lg rtl:rotate-180">
2424
<svg
2525
width="20"
2626
height="20"

src/components/DocsFooter.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const DocsPageFooter = memo<DocsPageFooterProps>(
2727
<>
2828
{prevRoute?.path || nextRoute?.path ? (
2929
<>
30-
<div className="max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-2 gap-4 py-4 md:py-12">
30+
<div className="grid grid-cols-1 gap-4 py-4 mx-auto max-w-7xl md:grid-cols-2 md:py-12">
3131
{prevRoute?.path ? (
3232
<FooterLink
3333
type="Previous"
@@ -69,21 +69,23 @@ function FooterLink({
6969
<NextLink
7070
href={href}
7171
className={cn(
72-
'flex gap-x-4 md:gap-x-6 items-center w-full md:w-80 px-4 md:px-5 py-6 border-2 border-transparent text-base leading-base text-link dark:text-link-dark rounded-lg group focus:text-link dark:focus:text-link-dark focus:bg-highlight focus:border-link dark:focus:bg-highlight-dark dark:focus:border-link-dark focus:border-opacity-100 focus:border-2 focus:ring-1 focus:ring-offset-4 focus:ring-blue-40 active:ring-0 active:ring-offset-0 hover:bg-gray-5 dark:hover:bg-gray-80',
72+
'flex gap-x-4 md:gap-x-6 items-center w-full md:min-w-80 md:w-fit md:max-w-md px-4 md:px-5 py-6 border-2 border-transparent text-base leading-base text-link dark:text-link-dark rounded-lg group focus:text-link dark:focus:text-link-dark focus:bg-highlight focus:border-link dark:focus:bg-highlight-dark dark:focus:border-link-dark focus:border-opacity-100 focus:border-2 focus:ring-1 focus:ring-offset-4 focus:ring-blue-40 active:ring-0 active:ring-offset-0 hover:bg-gray-5 dark:hover:bg-gray-80',
7373
{
74-
'flex-row-reverse justify-self-end text-right': type === 'Next',
74+
'flex-row-reverse justify-self-end text-end': type === 'Next',
7575
}
7676
)}>
7777
<IconNavArrow
78-
className="text-tertiary dark:text-tertiary-dark inline group-focus:text-link dark:group-focus:text-link-dark"
79-
displayDirection={type === 'Previous' ? 'left' : 'right'}
78+
className="inline text-tertiary dark:text-tertiary-dark group-focus:text-link dark:group-focus:text-link-dark"
79+
displayDirection={type === 'Previous' ? 'start' : 'end'}
8080
/>
81-
<span>
82-
<span className="block no-underline text-sm tracking-wide text-secondary dark:text-secondary-dark uppercase font-bold group-focus:text-link dark:group-focus:text-link-dark group-focus:text-opacity-100">
81+
<div className="flex flex-col overflow-hidden">
82+
<span className="text-sm font-bold tracking-wide no-underline uppercase text-secondary dark:text-secondary-dark group-focus:text-link dark:group-focus:text-link-dark group-focus:text-opacity-100">
8383
{type}
8484
</span>
85-
<span className="block text-lg group-hover:underline">{title}</span>
86-
</span>
85+
<span className="text-lg break-words group-hover:underline">
86+
{title}
87+
</span>
88+
</div>
8789
</NextLink>
8890
);
8991
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Error Decoder requires reading pregenerated error message from getStaticProps,
2+
// but MDX component doesn't support props. So we use React Context to populate
3+
// the value without prop-drilling.
4+
// TODO: Replace with React.cache + React.use when migrating to Next.js App Router
5+
6+
import {createContext, useContext} from 'react';
7+
8+
const notInErrorDecoderContext = Symbol('not in error decoder context');
9+
10+
export const ErrorDecoderContext = createContext<
11+
| {errorMessage: string | null; errorCode: string | null}
12+
| typeof notInErrorDecoderContext
13+
>(notInErrorDecoderContext);
14+
15+
export const useErrorDecoderParams = () => {
16+
const params = useContext(ErrorDecoderContext);
17+
18+
if (params === notInErrorDecoderContext) {
19+
throw new Error('useErrorDecoder must be used in error decoder pages only');
20+
}
21+
22+
return params;
23+
};

src/components/Icon/IconArrow.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import cn from 'classnames';
77

88
export const IconArrow = memo<
99
JSX.IntrinsicElements['svg'] & {
10-
displayDirection: 'left' | 'right' | 'up' | 'down';
10+
/**
11+
* The direction the arrow should point.
12+
* `start` and `end` are relative to the current locale.
13+
* for example, in LTR, `start` is left and `end` is right.
14+
*/
15+
displayDirection: 'start' | 'end' | 'right' | 'left' | 'up' | 'down';
1116
}
1217
>(function IconArrow({displayDirection, className, ...rest}) {
1318
return (
@@ -20,6 +25,7 @@ export const IconArrow = memo<
2025
{...rest}
2126
className={cn(className, {
2227
'rotate-180': displayDirection === 'right',
28+
'rotate-180 rtl:rotate-0': displayDirection === 'end',
2329
})}>
2430
<path fill="none" d="M0 0h24v24H0z" />
2531
<path d="M7.828 11H20v2H7.828l5.364 5.364-1.414 1.414L4 12l7.778-7.778 1.414 1.414z" />

src/components/Icon/IconArrowSmall.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ import cn from 'classnames';
77

88
export const IconArrowSmall = memo<
99
JSX.IntrinsicElements['svg'] & {
10-
displayDirection: 'left' | 'right' | 'up' | 'down';
10+
/**
11+
* The direction the arrow should point.
12+
* `start` and `end` are relative to the current locale.
13+
* for example, in LTR, `start` is left and `end` is right.
14+
*/
15+
displayDirection: 'start' | 'end' | 'right' | 'left' | 'up' | 'down';
1116
}
1217
>(function IconArrowSmall({displayDirection, className, ...rest}) {
1318
const classes = cn(className, {
1419
'rotate-180': displayDirection === 'left',
20+
'rotate-180 rtl:rotate-0': displayDirection === 'start',
1521
'rotate-90': displayDirection === 'down',
1622
});
1723
return (

src/components/Icon/IconCanary.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*/
4+
5+
import {memo} from 'react';
6+
7+
export const IconCanary = memo<JSX.IntrinsicElements['svg'] & {title?: string}>(
8+
function IconCanary({className, title}) {
9+
return (
10+
<svg
11+
className={className}
12+
width="20px"
13+
height="20px"
14+
viewBox="0 0 20 20"
15+
version="1.1"
16+
xmlns="http://www.w3.org/2000/svg">
17+
{title && <title>{title}</title>}
18+
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
19+
<g
20+
id="noun-labs-1201738-(2)"
21+
transform="translate(2, 0)"
22+
fill="currentColor"
23+
fillRule="nonzero">
24+
<path
25+
d="M10.2865804,5.55665262 L10.2865804,2.22331605 L10.8591544,2.22331605 C11.0103911,2.22244799 11.1551447,2.16342155 11.2617505,2.05914367 C11.3684534,1.95486857 11.4282767,1.81370176 11.4282767,1.66667106 L11.4282767,0.556642208 C11.4282767,0.40907262 11.3678934,0.26747526 11.2605218,0.16308627 C11.1531503,0.0587028348 11.0074938,0 10.8556998,0 L5.14338868,0 C4.9915947,0 4.84594391,0.0587028348 4.73856664,0.16308627 C4.63119507,0.267469704 4.57081178,0.40907262 4.57081178,0.556642208 L4.57081178,1.66667106 C4.57081178,1.81434899 4.63119507,1.95594912 4.73856664,2.06033811 C4.8459382,2.16472155 4.9915947,2.22331605 5.14338868,2.22331605 L5.71596273,2.22331605 L5.71596273,5.55665262 C5.71596273,8.38665538 2.97295619,9.88999017 0.651686904,15.5566623 C-0.0957823782,17.360053 -2.00560068,20 7.99951567,20 C18.004632,20 16.0948137,17.3600252 15.3507732,15.5566623 C13.0124432,9.88999017 10.2865804,8.38665538 10.2865804,5.55665262 Z M9.89570197,10.709991 C10.0921412,10.709991 10.2805515,10.7858383 10.4193876,10.9209301 C10.5583466,11.0559135 10.6363652,11.2390693 10.6363652,11.4300417 C10.6363652,11.6210141 10.5583466,11.8040698 10.4193876,11.9391533 C10.2805401,12.0741367 10.0921412,12.1499813 9.89570197,12.1499813 C9.6992627,12.1499813 9.51096673,12.074134 9.37201631,11.9391533 C9.23316875,11.8040615 9.15515307,11.6210141 9.15515307,11.4300417 C9.15515307,11.2390693 9.2331716,11.0559024 9.37201631,10.9209301 C9.57264221,10.7258996 9.61239426,10.709991 9.89570197,10.709991 Z M8.98919546,9.04212824 C9.09790709,9.14792278 9.15884755,9.29158681 9.1585213,9.44110085 C9.15829001,9.59073155 9.09678989,9.73407335 8.98763252,9.83954568 C8.87847514,9.945018 8.73069852,10.0039347 8.57678157,10.0033977 C8.42286747,10.0027392 8.27565088,9.94273467 8.16727355,9.83639845 C8.05900765,9.73006224 7.99873866,9.58628988 7.99963013,9.43664806 C8.00052304,9.28788403 8.0620221,9.14542556 8.17051087,9.04048101 C8.27911107,8.93555591 8.42599335,8.87663641 8.57913312,8.87663641 C8.73291864,8.87665585 8.88047525,8.93622535 8.98919546,9.04212824 Z M7.99965585,17.9999981 C4.91377349,17.9999981 3.29882839,17.7332867 2.51364277,17.4999976 C2.37780966,17.4476975 2.26954376,17.3439641 2.21396931,17.2125528 C2.15838628,17.0811499 2.16006066,16.9334692 2.21876871,16.8033858 C2.6144474,15.5921346 3.14916224,14.4280501 3.81316983,13.3333824 C5.980145,9.82337899 8.22941036,13.8867718 10.0980836,13.8867718 C11.9666996,13.8867718 11.4695868,12.1534924 12.1827971,13.3333824 C12.8511505,14.4269112 13.3916656,15.5896902 13.794259,16.8000524 C13.8533022,16.9322137 13.8537479,17.0822749 13.7952635,17.2147751 C13.7368889,17.3472613 13.6248314,17.4504531 13.4856467,17.5000531 C12.6833967,17.7332867 11.0855382,17.9999981 7.99965585,17.9999981 Z"
26+
id="Shape"></path>
27+
</g>
28+
</g>
29+
</svg>
30+
);
31+
}
32+
);

src/components/Icon/IconChevron.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import cn from 'classnames';
77

88
export const IconChevron = memo<
99
JSX.IntrinsicElements['svg'] & {
10-
displayDirection: 'up' | 'down' | 'left' | 'right';
10+
/**
11+
* The direction the arrow should point.
12+
* `start` and `end` are relative to the current locale.
13+
* for example, in LTR, `start` is left and `end` is right.
14+
*/
15+
displayDirection: 'start' | 'end' | 'right' | 'left' | 'up' | 'down';
1116
}
1217
>(function IconChevron({className, displayDirection}) {
1318
const classes = cn(
@@ -16,6 +21,8 @@ export const IconChevron = memo<
1621
'rotate-90': displayDirection === 'left',
1722
'rotate-180': displayDirection === 'up',
1823
'-rotate-90': displayDirection === 'right',
24+
'rotate-90 rtl:-rotate-90': displayDirection === 'start',
25+
'-rotate-90 rtl:rotate-90': displayDirection === 'end',
1926
},
2027
className
2128
);

src/components/Icon/IconGitHub.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export const IconGitHub = memo<JSX.IntrinsicElements['svg']>(
99
return (
1010
<svg
1111
xmlns="http://www.w3.org/2000/svg"
12-
width="1.33em"
13-
height="1.33em"
12+
width="1.5em"
13+
height="1.5em"
1414
viewBox="0 -2 24 24"
1515
fill="currentColor"
1616
{...props}>

src/components/Icon/IconNavArrow.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,22 @@ import cn from 'classnames';
77

88
export const IconNavArrow = memo<
99
JSX.IntrinsicElements['svg'] & {
10-
displayDirection: 'right' | 'down' | 'left';
10+
/**
11+
* The direction the arrow should point.
12+
* `start` and `end` are relative to the current locale.
13+
* for example, in LTR, `start` is left and `end` is right.
14+
*/
15+
displayDirection: 'start' | 'end' | 'right' | 'left' | 'down';
1116
}
12-
>(function IconNavArrow({displayDirection = 'right', className}) {
17+
>(function IconNavArrow({displayDirection = 'start', className}) {
1318
const classes = cn(
1419
'duration-100 ease-in transition',
1520
{
1621
'rotate-0': displayDirection === 'down',
17-
'-rotate-90': displayDirection === 'right',
1822
'rotate-90': displayDirection === 'left',
23+
'-rotate-90': displayDirection === 'right',
24+
'rotate-90 rtl:-rotate-90': displayDirection === 'start',
25+
'-rotate-90 rtl:rotate-90': displayDirection === 'end',
1926
},
2027
className
2128
);

0 commit comments

Comments
 (0)