Skip to content
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4295c24
chore: bump to rc.1
jbroma Dec 2, 2025
404bbc6
chore: update pnpm lockfile
jbroma Dec 2, 2025
b494e4a
chore: add react-dom as peer dep
jbroma Dec 2, 2025
8b92f6d
chore: bump typescript to 5.9.3
jbroma Dec 2, 2025
1137c1d
chore: replace themeOverrides with i18n overrides
jbroma Dec 2, 2025
c7e8331
fix: use flushSync from react-dom
jbroma Dec 2, 2025
cec7a92
fix: move editLinkText to i18n config
jbroma Dec 2, 2025
3829f19
fix: preset types
jbroma Dec 2, 2025
79528f5
fix: add empty placeholders
jbroma Dec 3, 2025
f8a2609
fix: theme aliasing
jbroma Dec 3, 2025
0b0a7db
fix: home hero
jbroma Dec 3, 2025
6e33307
chore: upgrade to rc2
jbroma Dec 11, 2025
f15a85e
feat: drop theme-assets aliases
jbroma Dec 11, 2025
9f65bb5
feat: align with new theme override logic
jbroma Dec 11, 2025
f26af4f
fix: styles part 1
jbroma Dec 11, 2025
f70b0a5
fix: button
jbroma Dec 12, 2025
0dd2287
chore: use theme directly in the tester
jbroma Dec 17, 2025
16f0e23
chore: reformat
jbroma Dec 17, 2025
d8b1fcc
fix: social links
jbroma Dec 17, 2025
461243b
fix: align items on home
jbroma Dec 17, 2025
2628dd3
fix: banner alignment
jbroma Dec 17, 2025
0ed5690
fix: home hero logo
jbroma Dec 17, 2025
1ac3bf4
fix: home background
jbroma Dec 17, 2025
bba2bda
fix: home features
jbroma Dec 17, 2025
29a3a23
fix: nav
jbroma Dec 17, 2025
0e0b031
fix: mobile hamburger
jbroma Dec 17, 2025
33d97c8
fix: search
jbroma Dec 17, 2025
59775b5
fix: outline cta
jbroma Dec 18, 2025
cb01da1
fix: mobile hamburger
jbroma Dec 18, 2025
c927921
fix: multiple style fixes
jbroma Dec 18, 2025
a06da39
refactor: split styles into multiple files
jbroma Dec 18, 2025
6a43d68
refactor: better split
jbroma Dec 18, 2025
1b8e580
fix: components
jbroma Dec 18, 2025
b0d9f36
refactor: remove redundant styles, reorder
jbroma Dec 18, 2025
59654fc
fix: links
jbroma Dec 18, 2025
c545d35
fix: toc
jbroma Dec 18, 2025
0737abe
fix: sidebar menu
jbroma Dec 18, 2025
eac0c76
fix: sidebar menu duplicated icon
jbroma Dec 18, 2025
2f7e6b9
fix: 404
jbroma Dec 18, 2025
433e543
fix: overviews
jbroma Dec 18, 2025
87e4d42
chore: remove tailwind remainings; fix ck logo in footer
thymikee Dec 29, 2025
98a7aab
side nav fixes
thymikee Dec 29, 2025
28bf423
fixup header margins and nav paddings
thymikee Dec 29, 2025
be394e9
fix OutlineCTA divider when outline
thymikee Dec 29, 2025
c8f70d2
fixup prev/next buttons
thymikee Dec 30, 2025
366a503
fixup dark/light logos in SSR
thymikee Dec 30, 2025
5920360
fix prev/next hover
thymikee Dec 30, 2025
8a8e4dd
remove important from link hovers
thymikee Dec 30, 2025
ca3fa1a
nav adjustments for new scrollbar behavior; set logo in tester
thymikee Dec 30, 2025
a326523
chore: add logos to prod config for tester
jbroma Dec 30, 2025
115631c
chore: upgrade to rspress 2.0.0-rc.3
jbroma Dec 30, 2025
95d3a54
fix: hide progress circle
jbroma Dec 30, 2025
1701d2f
fix: handle scroll to top button
jbroma Dec 30, 2025
7c56483
fix prev/next hover for prod which was removed by the optimizer due t…
thymikee Dec 30, 2025
88fe699
fix: sidebar fill width
jbroma Dec 30, 2025
e8a9a07
fix position of prev-next item desc
thymikee Dec 30, 2025
cf0aace
fix: use native thin scrollbar for sidebar
thymikee Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@
},
"dependencies": {
"@callstack/rspress-theme": "workspace:*",
"@rspress/plugin-llms": "2.0.0-beta.35",
"@rspress/plugin-sitemap": "2.0.0-beta.35",
"@rspress/plugin-llms": "2.0.0-rc.2",
"@rspress/plugin-sitemap": "2.0.0-rc.2",
"@vercel/analytics": "^1.5.0",
"rsbuild-plugin-open-graph": "^1.0.2",
"zod": "^3.23.8"
},
"peerDependencies": {
"@rspress/core": "2.0.0-beta.35"
"@rspress/core": "2.0.0-rc.2"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.52.8",
"@rslib/core": "^0.10.5",
"@rspress/core": "2.0.0-beta.35",
"@rspress/core": "2.0.0-rc.2",
"@types/node": "^22",
"typescript": "^5.8.3"
"typescript": "^5.9.3"
}
}
5 changes: 3 additions & 2 deletions packages/preset/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const CALLSTACK_BASE_URL = 'https://www.callstack.com';
const CALLSTACK_CONTACT_URL = 'https://www.callstack.com/contact';

type SupportedSocialLinks = Exclude<
Parameters<typeof SocialLinksComponent>[0]['socialLinks'][number]['icon'],
NonNullable<
Parameters<typeof SocialLinksComponent>[0]['socialLinks']
>[number]['icon'],
{ svg: string }
>;
type Socials = Partial<Record<SupportedSocialLinks, string>>;
Expand Down Expand Up @@ -139,7 +141,6 @@ const createPreset = (config: PresetConfig): UserConfig => {
},
editLink: {
docRepoBaseUrl: docs.editUrl,
text: 'Edit this page on GitHub',
},
socialLinks: createSocialLinks(docs.socials),
},
Expand Down
4 changes: 2 additions & 2 deletions packages/tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"preview": "rspress preview"
},
"dependencies": {
"@rspress/core": "^2.0.0-beta.35",
"@rspress/core": "^2.0.0-rc.2",
"@callstack/rspress-preset": "workspace:*",
"@callstack/rspress-theme": "workspace:*"
},
"devDependencies": {
"@types/node": "^22",
"@types/react": "^19"
"@types/react": "^19.2.0"
}
}
64 changes: 53 additions & 11 deletions packages/tester/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,56 @@
import * as path from 'node:path';
import { withCallstackPreset } from '@callstack/rspress-preset';
import { pluginCallstackTheme } from '@callstack/rspress-theme/plugin';
import { defineConfig } from '@rspress/core';

export default withCallstackPreset(
const isDev = process.env.NODE_ENV === 'development';

const themeOptions = {
content: {
homeBannerButtonText: 'Home Banner Button Text',
homeBannerDescription: 'Home Banner Description',
homeBannerHeadline: 'Home Banner Headline',
outlineCTAButtonText: 'Outline CTA Button Text',
outlineCTADescription: 'Outline CTA Description',
outlineCTAHeadline: 'Outline CTA Headline',
},
};

const devConfig = defineConfig({
root: path.join(__dirname, 'docs'),
title: 'My Site',
description: 'My Site Description',
logo: {
dark: '/logo-dark.png',
light: '/logo-light.png',
},
themeConfig: {
editLink: {
docRepoBaseUrl: 'https://github.com/callstack/rspress-theme',
},
socialLinks: [
{
icon: 'github',
mode: 'link',
content: 'https://github.com/callstack/rspress-theme',
},
{ icon: 'X', mode: 'link', content: 'https://x.com/repack_rn' },
{
icon: 'discord',
mode: 'link',
content: 'https://github.com/callstack/rspress-theme',
},
],
},
plugins: [pluginCallstackTheme(themeOptions)],
builderConfig: {
performance: {
buildCache: false,
},
},
});

const prodConfig = withCallstackPreset(
{
context: path.join(__dirname),
docs: {
Expand All @@ -16,16 +65,7 @@ export default withCallstackPreset(
discord: 'https://github.com/callstack/rspress-theme',
},
},
theme: {
content: {
homeBannerButtonText: 'Home Banner Button Text',
homeBannerDescription: 'Home Banner Description',
homeBannerHeadline: 'Home Banner Headline',
outlineCTAButtonText: 'Outline CTA Button Text',
outlineCTADescription: 'Outline CTA Description',
outlineCTAHeadline: 'Outline CTA Headline',
},
},
theme: themeOptions,
},
{
builderConfig: {
Expand All @@ -35,3 +75,5 @@ export default withCallstackPreset(
},
}
);

export default isDev ? devConfig : prodConfig;
4 changes: 2 additions & 2 deletions packages/tester/theme/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Announcement, VersionBadge } from '@callstack/rspress-theme';
import { Layout as RspressLayout } from '@rspress/core/theme';
import { Layout as RspressLayout } from '@rspress/core/theme-original';

const Layout = () => {
return (
Expand All @@ -18,4 +18,4 @@ const Layout = () => {

export { Layout };

export * from '@rspress/core/theme';
export * from '@rspress/core/theme-original';
15 changes: 9 additions & 6 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"@rspress/core": "^2.0.0-beta.35",
"react": "^19.0.0"
"@rspress/core": "^2.0.0-rc.2",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.52.8",
Expand All @@ -55,10 +56,12 @@
"@rsbuild/plugin-sass": "^1.3.3",
"@rsbuild/plugin-svgr": "^1.2.1",
"@rslib/core": "^0.10.5",
"@rspress/core": "^2.0.0-beta.35",
"@rspress/core": "^2.0.0-rc.2",
"@types/node": "^22",
"@types/react": "^19",
"react": "^19",
"typescript": "^5.8.3"
"@types/react": "^19.2.0",
"@types/react-dom": "^19.2.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"typescript": "^5.9.3"
}
}
3 changes: 3 additions & 0 deletions packages/theme/src/assets/arrow-bar-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/theme/src/assets/gradient-dark.avif
Binary file not shown.
Binary file added packages/theme/src/assets/gradient-light.avif
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/theme/src/assets/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/theme/src/assets/small-menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions packages/theme/src/plugin/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const OUTLINE_TITLE = 'Contents';
export const SEARCH_NO_RESULTS_TEXT =
'No results found, try something different than';

export const SEARCH_SUGGESTED_QUERY_TEXT = '';
export const SEARCH_SUGGESTED_QUERY_TEXT = ' ';

export const OVERVIEW_FILTER_NAME_TEXT = '';
export const OVERVIEW_FILTER_NAME_TEXT = ' ';

export const OUTLINE_CTA_BUTTON_TEXT = "Let's talk";
export const OUTLINE_CTA_DESCRIPTION =
Expand All @@ -27,3 +27,5 @@ export const HOME_BANNER_BUTTON_TEXT = "Let's talk";
export const HOME_BANNER_LINK = 'https://www.callstack.com/contact';

export const HOME_FOOTER_LINK = 'https://callstack.com';

export const EDIT_LINK_TEXT = 'Edit this page on GitHub';
4 changes: 4 additions & 0 deletions packages/theme/src/plugin/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: string;
export default content;
}
102 changes: 43 additions & 59 deletions packages/theme/src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'node:fs';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
Expand Down Expand Up @@ -33,32 +32,21 @@ function excludeFalse<T>(value: T): value is Exclude<T, false> {
return value !== false;
}

function getThemeAssets() {
const assetsDirPath = path.join(dirname, '../assets');
const contents = fs.readdirSync(assetsDirPath);
return contents
.map(path.parse)
.map(({ base, name }) => [
`@theme-assets/${name}`,
path.join(assetsDirPath, base),
]);
}

function getThemeAliases(
existingThemeAlias: AliasEntry
): Record<string, string | string[]> {
const ckThemeExportsPath = path.join(dirname, 'theme');

const { resolve } = createRequire(import.meta.url);
const rspressThemeDefaultPath = resolve('@rspress/theme-default', {
const rspressCoreThemePath = resolve('@rspress/core/theme', {
paths: [resolve('@rspress/core/package.json')],
});

const aliases: Record<string, string | string[]> = {};

// Handle @theme alias
if (Array.isArray(existingThemeAlias)) {
const index = existingThemeAlias.indexOf(rspressThemeDefaultPath);
const index = existingThemeAlias.indexOf(rspressCoreThemePath);
if (index !== -1) {
aliases['@theme'] = existingThemeAlias.filter(excludeFalse).slice();
aliases['@theme'].splice(index, 0, ckThemeExportsPath);
Expand All @@ -74,29 +62,13 @@ function getThemeAliases(
}

// Add alias for @default-theme to avoid circular dependency
aliases['@default-theme'] = rspressThemeDefaultPath;
aliases['@default-theme'] = rspressCoreThemePath;
// Alias rspress/theme to our theme to keep the theme override pattern from Rspress docs
aliases['@rspress/core/theme'] = ckThemeExportsPath;

return aliases;
}

function getThemeAssetAlias(
existingAssetAlias: AliasEntry
): Record<string, string | string[]> {
const assetOverrides = getThemeAssets();
const aliases: Record<string, string | string[]> = {};

for (const [assetAlias, assetPath] of assetOverrides) {
if (Array.isArray(existingAssetAlias)) {
aliases[assetAlias] = existingAssetAlias.filter(excludeFalse);
aliases[assetAlias].push(assetPath);
} else if (existingAssetAlias) {
aliases[assetAlias] = [existingAssetAlias, assetPath];
} else {
aliases[assetAlias] = assetPath;
}
}
// Alias @theme-original and @rspress/core/theme-original to always override
// the original theme
aliases['@theme-original'] = ckThemeExportsPath;
aliases['@rspress/core/theme-original'] = ckThemeExportsPath;

return aliases;
}
Expand Down Expand Up @@ -137,16 +109,6 @@ function getBuilderConfig(options: PluginCallstackThemeOptions): BuilderConfig {
},
resolve: {
alias: (alias) => {
// add '@theme-assets' aliases but keep the custom ones from user
const assetAliases = getThemeAssetAlias(alias['@theme-assets']);
Object.assign(alias, assetAliases);

// remove & add existing @theme-assets alias to keep specific aliases on top
const themeAssetsAlias = alias['@theme-assets'];
// biome-ignore lint/performance/noDelete: change property order
delete alias['@theme-assets'];
Object.assign(alias, { '@theme-assets': themeAssetsAlias });

// add '@theme', '@default-theme' & 'rspress/theme' aliases
// @ts-ignore
const themeAliases = getThemeAliases(alias['@theme']);
Expand All @@ -156,26 +118,49 @@ function getBuilderConfig(options: PluginCallstackThemeOptions): BuilderConfig {
};
}

function addThemeOverrides(themeConfig: UserConfig['themeConfig'] = {}) {
if (!themeConfig.overview) {
themeConfig.overview = { filterNameText: consts.OVERVIEW_FILTER_NAME_TEXT };
} else if (!themeConfig.overview.filterNameText) {
themeConfig.overview.filterNameText = consts.OVERVIEW_FILTER_NAME_TEXT;
function getI18nSourceOverrides(
existingI18nSource: UserConfig['i18nSource'] = {}
): UserConfig['i18nSource'] {
const i18nSource: UserConfig['i18nSource'] = {
...existingI18nSource,
};

if (!i18nSource['overview.filterNameText']) {
i18nSource['overview.filterNameText'] = {
en: consts.OVERVIEW_FILTER_NAME_TEXT,
zh: consts.OVERVIEW_FILTER_NAME_TEXT,
};
}

if (!i18nSource.outlineTitle) {
i18nSource.outlineTitle = {
en: consts.OUTLINE_TITLE,
zh: consts.OUTLINE_TITLE,
};
}

if (!themeConfig.outlineTitle) {
themeConfig.outlineTitle = consts.OUTLINE_TITLE;
if (!i18nSource.searchNoResultsText) {
i18nSource.searchNoResultsText = {
en: consts.SEARCH_NO_RESULTS_TEXT,
zh: consts.SEARCH_NO_RESULTS_TEXT,
};
}

if (!themeConfig.searchNoResultsText) {
themeConfig.searchNoResultsText = consts.SEARCH_NO_RESULTS_TEXT;
if (!i18nSource.searchSuggestedQueryText) {
i18nSource.searchSuggestedQueryText = {
en: consts.SEARCH_SUGGESTED_QUERY_TEXT,
zh: consts.SEARCH_SUGGESTED_QUERY_TEXT,
};
}

if (!themeConfig.searchSuggestedQueryText) {
themeConfig.searchSuggestedQueryText = consts.SEARCH_SUGGESTED_QUERY_TEXT;
if (!i18nSource.editLinkText) {
i18nSource.editLinkText = {
en: consts.EDIT_LINK_TEXT,
zh: consts.EDIT_LINK_TEXT,
};
}

return themeConfig;
return i18nSource;
}

function normalizeOptions(options: PluginCallstackThemeOptions) {
Expand Down Expand Up @@ -218,9 +203,8 @@ export function pluginCallstackTheme(
name: 'plugin-callstack-theme',
// replace default theme & theme assets
builderConfig: getBuilderConfig(normalizedOptions),
// add ck theme defaults if not present
config: (config) => {
config.themeConfig = addThemeOverrides(config.themeConfig);
config.i18nSource = getI18nSourceOverrides(config.i18nSource);
return config;
},
// inject style overrides
Expand Down
Loading