@primer/doctocat-nextjs 0.0.0-20251216140616 → 0.0.0-20251216142147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -10
- package/components/layout/article/AccessibilityLabel.module.css +1 -5
- package/components/layout/article/AccessibilityLabel.tsx +8 -5
- package/components/layout/article/ReadinessLabel.module.css +1 -5
- package/components/layout/article/ReadinessLabel.tsx +8 -5
- package/components/layout/code-block/ReactCodeBlock.tsx +4 -4
- package/components/layout/global-search/GlobalSearch.tsx +1 -0
- package/components/layout/header/Header.tsx +10 -1
- package/components/layout/nav-drawer/NavDrawer.tsx +1 -1
- package/components/layout/related-content-links/getRelatedPages.tsx +5 -2
- package/package.json +8 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
# @primer/doctocat-nextjs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20251216142147
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Fake entry to force publishing
|
|
8
8
|
|
|
9
|
-
## 0.
|
|
9
|
+
## 0.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#73](https://github.com/primer/doctocat-nextjs/pull/73) [`a06099d`](https://github.com/primer/doctocat-nextjs/commit/a06099d65d36bdb361fc9a20b2b811990bb6d353) Thanks [@danielguillan](https://github.com/danielguillan)! - Add React 19 support
|
|
14
|
+
|
|
15
|
+
This update is backwards compatible with React 18. However, it upgrades `@primer/react` to v38, which includes breaking changes such as the removal of the `Box` component and `sx` prop. Projects using this theme may need to update their code accordingly.
|
|
16
|
+
- Updated React peer dependency to support React 19
|
|
17
|
+
- Updated @primer/react from v37.11.2 to v38.3.0
|
|
18
|
+
- Updated `@primer/react-brand` from v0.54.0 to v0.60.1
|
|
19
|
+
- Updated `framer-motion` from v12.4.0 to v12.23.24
|
|
20
|
+
- Updated `react-focus-on` from v3.9.4 to v3.10.0
|
|
21
|
+
- Migrated `Label` components to `Token` for React 19 compatibility
|
|
22
|
+
- Fixed type errors in `ReactCodeBlock` and `getRelatedPages` for stricter React 19 types
|
|
23
|
+
- Added explicit `as="button"` to `IconButton` and `as="input"` to `TextInput` components
|
|
24
|
+
- Updated Next.js and related packages from v15.5.2 to v15.5.7
|
|
10
25
|
|
|
11
26
|
### Patch Changes
|
|
12
27
|
|
|
@@ -17,7 +32,6 @@
|
|
|
17
32
|
### Minor Changes
|
|
18
33
|
|
|
19
34
|
- [#65](https://github.com/primer/doctocat-nextjs/pull/65) [`dc680ec`](https://github.com/primer/doctocat-nextjs/commit/dc680ec51605bd7a40dedc71cd3bb107632035dd) Thanks [@rezrah](https://github.com/rezrah)! - Updated Next.js compatibility to v15.5.x, Nextra to v4, and fix React code block rendering
|
|
20
|
-
|
|
21
35
|
- **Next.js v15.5.2**: Upgraded to latest stable version across all workspaces
|
|
22
36
|
- **Nextra v4 compatibility**: Updated type definitions for `ReactNode` titles
|
|
23
37
|
- **Fixed code block rendering**: Added client-side rendering for interactive code examples to handle React lazy components properly
|
|
@@ -75,7 +89,6 @@
|
|
|
75
89
|
```
|
|
76
90
|
|
|
77
91
|
- [#48](https://github.com/primer/doctocat-nextjs/pull/48) [`ce73c24`](https://github.com/primer/doctocat-nextjs/commit/ce73c24b2e4e924667bf7446a504bd88d8f2ccf0) Thanks [@rezrah](https://github.com/rezrah)! - - Fix inline code font-size in markdown headings. Now inherits size used in the heading.
|
|
78
|
-
|
|
79
92
|
- Increased spacing below React code blocks, which was previously too small.
|
|
80
93
|
|
|
81
94
|
- [#50](https://github.com/primer/doctocat-nextjs/pull/50) [`5d67989`](https://github.com/primer/doctocat-nextjs/commit/5d679895408c1a58342419692db4234dfddefd80) Thanks [@rezrah](https://github.com/rezrah)! - Add `menu-position` frontmatter support for custom sidebar navigation ordering
|
|
@@ -93,7 +106,6 @@
|
|
|
93
106
|
### Patch Changes
|
|
94
107
|
|
|
95
108
|
- [#41](https://github.com/primer/doctocat-nextjs/pull/41) [`e1ffb3a`](https://github.com/primer/doctocat-nextjs/commit/e1ffb3a630c51316a19e25869f731b4ef3660d2b) Thanks [@danielguillan](https://github.com/danielguillan)! - - Updated sidebar styles.
|
|
96
|
-
|
|
97
109
|
- Added active header link as sidebar heading.
|
|
98
110
|
- Made active header the root item of breadcrumbs, if available.
|
|
99
111
|
- Made sidebar group headlines link to the index page.
|
|
@@ -117,7 +129,6 @@
|
|
|
117
129
|
### Minor Changes
|
|
118
130
|
|
|
119
131
|
- [#30](https://github.com/primer/doctocat-nextjs/pull/30) [`cdcb65e`](https://github.com/primer/doctocat-nextjs/commit/cdcb65e087d647a6d61c87d9122f105dcda64e35) Thanks [@joshfarrant](https://github.com/joshfarrant)! - - Arbitrary links can now be added to the sidebar and header using the `Theme` component's `headerLinks` and `sidebarLinks` props.
|
|
120
|
-
|
|
121
132
|
- Updated the header navigation to more closely visually align it with the existing Primer docs navigation.
|
|
122
133
|
- Removed `_meta.global.ts` and instead directly pass header and sidebar links into the Doctocat `Theme` component.
|
|
123
134
|
|
|
@@ -147,7 +158,6 @@
|
|
|
147
158
|
### Patch Changes
|
|
148
159
|
|
|
149
160
|
- [#34](https://github.com/primer/doctocat-nextjs/pull/34) [`ccf198c`](https://github.com/primer/doctocat-nextjs/commit/ccf198cca25b1f021c5ae78b8e2760c141a77dcc) Thanks [@rezrah](https://github.com/rezrah)! - Collection of UI bugfixes:
|
|
150
|
-
|
|
151
161
|
- Sidebar offset added to prevent links being trapped under fixed header
|
|
152
162
|
- Narrow viewport overflow bug fixed
|
|
153
163
|
- Table of contents presentation fixed on narrow viewport, and has improved presentation on wider breakpoints.
|
|
@@ -196,7 +206,6 @@
|
|
|
196
206
|
### Minor Changes
|
|
197
207
|
|
|
198
208
|
- [#20](https://github.com/primer/doctocat-nextjs/pull/20) [`be8bc6a`](https://github.com/primer/doctocat-nextjs/commit/be8bc6af733ba40bdd4393b876b2653017d7e846) Thanks [@rezrah](https://github.com/rezrah)! - Dropped support for Next.js Pages router in favor of App Router + Nextra v4
|
|
199
|
-
|
|
200
209
|
- [Read the migration guide from `v0.1.0` to `v0.2.0`](https://github.com/primer/doctocat-nextjs/blob/main/migration-guides/v0.2.0-app-router.md)
|
|
201
210
|
|
|
202
211
|
## 0.1.0
|
|
@@ -206,7 +215,6 @@
|
|
|
206
215
|
- [#18](https://github.com/primer/doctocat-nextjs/pull/18) [`bfe68b1`](https://github.com/primer/doctocat-nextjs/commit/bfe68b14e8e3b4383ea41dcbf47373df8a130567) Thanks [@rezrah](https://github.com/rezrah)! - Upgraded internal framework to [Nextra v3](https://the-guild.dev/blog/nextra-3).
|
|
207
216
|
|
|
208
217
|
To migrate Doctocat to this release, follow these steps:
|
|
209
|
-
|
|
210
218
|
1. Install the latest version `npm i @primer/doctocat-nextjs@0.1.0`
|
|
211
219
|
2. Rename your `next.config.js` to be `next.config.mjs`. Add `type="module"` to your `package.json` and update the file contents to match the following:
|
|
212
220
|
|
|
@@ -282,7 +290,6 @@
|
|
|
282
290
|
- [`6f21970`](https://github.com/primer/doctocat-nextjs/commit/6f21970c74f7635be89fc4cd20376d7fe5ca35e7) Thanks [@rezrah](https://github.com/rezrah)! - Switch hero image order with description and reduce `h2` block start margin
|
|
283
291
|
|
|
284
292
|
- [#6](https://github.com/primer/doctocat-nextjs/pull/6) [`afd4e17`](https://github.com/primer/doctocat-nextjs/commit/afd4e1762f6294a14942d415c693319a874cd3fb) Thanks [@rezrah](https://github.com/rezrah)! - - Add MDX to HTML overrides mechanism and apply to headings and anchors
|
|
285
|
-
|
|
286
293
|
- Added anchor links to headings to match current functionality on primer.style
|
|
287
294
|
|
|
288
295
|
- [`b49f218`](https://github.com/primer/doctocat-nextjs/commit/b49f218e9bbc2de720476e21888956bee6081967) Thanks [@rezrah](https://github.com/rezrah)! - Removed sidebar links and added skip to main content a11y link
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
.reviewedLabel {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
gap: var(--base-size-8);
|
|
5
2
|
background-color: var(--base-color-scale-purple-0);
|
|
6
|
-
|
|
7
|
-
color: var(--brand-color-text-default);
|
|
3
|
+
color: var(--brand-color-text-default) !important;
|
|
8
4
|
font-weight: var(--brand-text-weight-300);
|
|
9
5
|
}
|
|
10
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
2
|
+
import {Token} from '@primer/react'
|
|
3
3
|
import {AccessibilityInsetIcon} from '@primer/octicons-react'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
|
|
@@ -11,9 +11,12 @@ type AccessibilityLabelProps = {
|
|
|
11
11
|
|
|
12
12
|
export function AccessibilityLabel({short}: AccessibilityLabelProps) {
|
|
13
13
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<Token
|
|
15
|
+
as="span"
|
|
16
|
+
size="large"
|
|
17
|
+
className={styles.reviewedLabel}
|
|
18
|
+
leadingVisual={() => <AccessibilityInsetIcon className={styles.icon} aria-hidden="true" />}
|
|
19
|
+
text={short ? 'Reviewed' : 'Reviewed for accessibility'}
|
|
20
|
+
/>
|
|
18
21
|
)
|
|
19
22
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
.label {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
gap: var(--base-size-8);
|
|
5
2
|
background-color: var(--base-color-scale-green-0);
|
|
6
|
-
|
|
7
|
-
color: var(--brand-color-text-default);
|
|
3
|
+
color: var(--brand-color-text-default) !important;
|
|
8
4
|
font-weight: var(--brand-text-weight-300);
|
|
9
5
|
}
|
|
10
6
|
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import {Token} from '@primer/react'
|
|
4
4
|
import {CheckIcon} from '@primer/octicons-react'
|
|
5
5
|
|
|
6
6
|
import styles from './ReadinessLabel.module.css'
|
|
7
7
|
|
|
8
8
|
export function ReadinessLabel() {
|
|
9
9
|
return (
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
<Token
|
|
11
|
+
as="span"
|
|
12
|
+
size="large"
|
|
13
|
+
className={styles.label}
|
|
14
|
+
leadingVisual={() => <CheckIcon className={styles.icon} aria-hidden="true" />}
|
|
15
|
+
text="Ready to use"
|
|
16
|
+
/>
|
|
14
17
|
)
|
|
15
18
|
}
|
|
@@ -205,13 +205,13 @@ export function ReactCodeBlock(props: ReactCodeBlockProps) {
|
|
|
205
205
|
* Helper function to turn Nextra <code> children into plain text
|
|
206
206
|
*/
|
|
207
207
|
function getCodeFromChildren(children: React.ReactNode) {
|
|
208
|
-
if (!React.isValidElement(children) || !children.props?.children) return ''
|
|
209
|
-
|
|
210
|
-
// Flattens the nested spans and combine their text content if it's a react child
|
|
211
208
|
const extractText = (node: React.ReactNode): string => {
|
|
212
209
|
if (typeof node === 'string') return node
|
|
213
210
|
if (Array.isArray(node)) return node.map(extractText).join('')
|
|
214
|
-
if (React.isValidElement(node)
|
|
211
|
+
if (React.isValidElement(node)) {
|
|
212
|
+
const element = node as React.ReactElement<{children?: React.ReactNode}>
|
|
213
|
+
return extractText(element.props.children)
|
|
214
|
+
}
|
|
215
215
|
return ''
|
|
216
216
|
}
|
|
217
217
|
|
|
@@ -170,6 +170,7 @@ export const GlobalSearch = forwardRef<HTMLInputElement, GlobalSearchProps>(
|
|
|
170
170
|
<FormControl>
|
|
171
171
|
<FormControl.Label visuallyHidden>Search</FormControl.Label>
|
|
172
172
|
<TextInput
|
|
173
|
+
as="input"
|
|
173
174
|
contrast
|
|
174
175
|
type="search"
|
|
175
176
|
className={styles.GlobalSearch__searchInput}
|
|
@@ -109,7 +109,13 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
|
|
|
109
109
|
<Text as="p" size="300" weight="semibold">
|
|
110
110
|
Search
|
|
111
111
|
</Text>
|
|
112
|
-
<IconButton
|
|
112
|
+
<IconButton
|
|
113
|
+
as="button"
|
|
114
|
+
icon={XIcon}
|
|
115
|
+
variant="invisible"
|
|
116
|
+
aria-label="Close search"
|
|
117
|
+
onClick={closeSearch}
|
|
118
|
+
/>
|
|
113
119
|
</Stack>
|
|
114
120
|
</div>
|
|
115
121
|
</FocusOn>
|
|
@@ -117,12 +123,14 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
|
|
|
117
123
|
<div>
|
|
118
124
|
<Stack direction="horizontal" padding="none" gap={4}>
|
|
119
125
|
<IconButton
|
|
126
|
+
as="button"
|
|
120
127
|
icon={colorMode === 'light' ? SunIcon : MoonIcon}
|
|
121
128
|
variant="invisible"
|
|
122
129
|
aria-label={`Switch to ${colorMode === 'light' ? 'dark' : 'light'} mode`}
|
|
123
130
|
onClick={() => setColorMode(colorMode === 'light' ? 'dark' : 'light')}
|
|
124
131
|
/>
|
|
125
132
|
<IconButton
|
|
133
|
+
as="button"
|
|
126
134
|
ref={searchTriggerRef}
|
|
127
135
|
className={styles.Header__searchButton}
|
|
128
136
|
icon={SearchIcon}
|
|
@@ -132,6 +140,7 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
|
|
|
132
140
|
/>
|
|
133
141
|
<div className={styles.Header__navDrawerContainer}>
|
|
134
142
|
<IconButton
|
|
143
|
+
as="button"
|
|
135
144
|
icon={ThreeBarsIcon}
|
|
136
145
|
variant="invisible"
|
|
137
146
|
aria-label="Menu"
|
|
@@ -26,7 +26,7 @@ export function NavDrawer({isOpen, onDismiss, pageMap}: NavDrawerProps) {
|
|
|
26
26
|
<Link as={NextLink} href="https://primer.style" className={styles.headerLink}>
|
|
27
27
|
Explore
|
|
28
28
|
</Link>
|
|
29
|
-
<IconButton icon={XIcon} aria-label="Close" onClick={onDismiss} variant="invisible" />
|
|
29
|
+
<IconButton as="button" icon={XIcon} aria-label="Close" onClick={onDismiss} variant="invisible" />
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
32
|
<div className={styles.navContainer}>{/* <PrimerNavItems items={primerNavItems} /> */}</div>
|
|
@@ -66,8 +66,11 @@ function titleToString(title: React.ReactNode): string {
|
|
|
66
66
|
if (typeof child === 'string' || typeof child === 'number') {
|
|
67
67
|
return child.toString()
|
|
68
68
|
}
|
|
69
|
-
if (React.isValidElement(child)
|
|
70
|
-
|
|
69
|
+
if (React.isValidElement(child)) {
|
|
70
|
+
const element = child as React.ReactElement<{children?: React.ReactNode}>
|
|
71
|
+
if (element.props.children) {
|
|
72
|
+
return titleToString(element.props.children)
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
return ''
|
|
73
76
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/doctocat-nextjs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20251216142147",
|
|
4
4
|
"description": "A Next.js theme for building Primer documentation sites",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,16 +25,14 @@
|
|
|
25
25
|
"react-dom": ">=18.0.0 <20.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@next/mdx": "15.5.
|
|
28
|
+
"@next/mdx": "15.5.7",
|
|
29
29
|
"@primer/octicons-react": "19.15.1",
|
|
30
|
-
"@primer/react": "^38.
|
|
30
|
+
"@primer/react": "^38.3.0",
|
|
31
31
|
"@types/lodash.debounce": "^4.0.9",
|
|
32
|
-
"framer-motion": "12.
|
|
32
|
+
"framer-motion": "12.23.24",
|
|
33
33
|
"lodash.debounce": "^4.0.8",
|
|
34
34
|
"nextra": "4.4.0",
|
|
35
|
-
"react": "
|
|
36
|
-
"react-dom": ">=18.0.0 <20.0.0",
|
|
37
|
-
"react-focus-on": "3.9.4",
|
|
35
|
+
"react-focus-on": "^3.10.0",
|
|
38
36
|
"react-live": "^4.1.8"
|
|
39
37
|
},
|
|
40
38
|
"devDependencies": {
|
|
@@ -44,19 +42,15 @@
|
|
|
44
42
|
"@testing-library/react": "^16.1.0",
|
|
45
43
|
"@testing-library/user-event": "^14.5.2",
|
|
46
44
|
"@types/node": "^20.19.0",
|
|
47
|
-
"@types/react": "
|
|
48
|
-
"@types/react-dom": "
|
|
45
|
+
"@types/react": "^19.2.7",
|
|
46
|
+
"@types/react-dom": "^19.2.3",
|
|
49
47
|
"@vitejs/plugin-react": "^4.3.3",
|
|
50
48
|
"@vitest/coverage-v8": "^3.2.4",
|
|
51
49
|
"@vitest/ui": "^3.2.4",
|
|
52
50
|
"clsx": "2.1.1",
|
|
53
51
|
"jsdom": "^26.0.1",
|
|
54
|
-
"next": "15.5.
|
|
52
|
+
"next": "15.5.7",
|
|
55
53
|
"styled-components": "5.3.11",
|
|
56
54
|
"vitest": "^3.2.4"
|
|
57
|
-
},
|
|
58
|
-
"overrides": {
|
|
59
|
-
"@types/react": "18.3.12",
|
|
60
|
-
"@types/react-dom": "18.3.1"
|
|
61
55
|
}
|
|
62
56
|
}
|