Skip to content

feat(core): move Llms runtime components from plugin-llms to core/theme#3026

Merged
SoonIter merged 6 commits intomainfrom
syt-vibe-kanban/4c18-plugin-llms-llms
Jan 19, 2026
Merged

feat(core): move Llms runtime components from plugin-llms to core/theme#3026
SoonIter merged 6 commits intomainfrom
syt-vibe-kanban/4c18-plugin-llms-llms

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Jan 19, 2026

Summary

Related Issue

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

AI Summary

What was changed

This PR moves the LLMS-related runtime components from @rspress/plugin-llms to @rspress/core/theme, making them built-in components available to all Rspress users.

Components moved to core/src/theme/components/Llms/:

  • LlmsContainer - A container component for LLMS UI elements
  • LlmsCopyButton - A button component that copies markdown content to clipboard
  • LlmsViewOptions - A dropdown menu component with options to open content in ChatGPT, Claude, or copy markdown links
  • useMdUrl - A hook that returns the current page's markdown file URL

Changes to @rspress/plugin-llms:

  • Runtime components now re-export from @rspress/core/theme for backward compatibility
  • Removed local component implementations and SCSS module files
  • Removed @rsbuild/plugin-sass dependency (no longer needed)
  • Simplified rslib.config.ts build configuration

Why

Moving these components to core provides several benefits:

  1. Better reusability - Components are now available to any Rspress project without requiring the plugin
  2. Reduced bundle size - Users who only need the components don't need to install the full plugin
  3. Consistent theming - Components now live alongside other theme components, using the same styling patterns
  4. Backward compatibility - Existing users of @rspress/plugin-llms/runtime will continue to work

Usage

Users can now import these components directly from core:

import { LlmsContainer, LlmsCopyButton, LlmsViewOptions, useMdUrl } from '@rspress/core/theme';

Or continue using the plugin import (backward compatible):

import { LlmsContainer, LlmsCopyButton, LlmsViewOptions, useMdUrl } from '@rspress/plugin-llms/runtime';

This PR was written using Vibe Kanban

## 完成的工作

已成功将 `plugin-llms` 中的 `LlmsViewOptions` 等组件内置到 `@rspress/core` 中。

### 1. 在 `core/src/theme/components/Llms/` 目录下创建了以下文件:

- `useMdUrl.ts` - 获取当前页面 markdown 文件 URL 的 hook
- `IconCopy.tsx` - 复制图标组件
- `LlmsContainer.tsx` + `LlmsContainer.module.scss` - 容器组件
- `LlmsCopyButton.tsx` + `LlmsCopyButton.module.scss` - 复制 Markdown 内容的按钮组件
- `LlmsViewOptions.tsx` + `LlmsViewOptions.module.scss` - 下拉菜单选项组件(支持打开 ChatGPT、Claude 等)
- `index.tsx` - 导出文件

### 2. 在 `core/src/theme/index.ts` 中添加了导出:

```ts
export {
  LlmsContainer,
  type LlmsContainerProps,
  LlmsCopyButton,
  type LlmsCopyButtonProps,
  LlmsViewOptions,
  type LlmsViewOptionsProps,
  useMdUrl,
} from './components/Llms/index';
```

### 3. 更新了 `plugin-llms`:

- `src/runtime/index.tsx` 现在从 `@rspress/core/theme` 重新导出这些组件
- 删除了原来的组件文件(LlmsContainer、LlmsCopyButton、LlmsViewOptions、useMdUrl、IconCopy 及其样式文件)
- 更新了 `rslib.config.ts` 移除了 Sass 插件
- 更新了 `package.json` 移除了 `@rsbuild/plugin-sass` 依赖

用户现在可以直接从 `@rspress/core/theme` 导入这些组件:

```ts
import { LlmsContainer, LlmsCopyButton, LlmsViewOptions, useMdUrl } from '@rspress/core/theme';
```

或者继续使用 `@rspress/plugin-llms/runtime`(向后兼容):

```ts
import { LlmsContainer, LlmsCopyButton, LlmsViewOptions, useMdUrl } from '@rspress/plugin-llms/runtime';
```
Copilot AI review requested due to automatic review settings January 19, 2026 09:55
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 19, 2026

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 8e26ae5
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/696e0cc79a4dd60008f05a6c
😎 Deploy Preview https://deploy-preview-3026--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SoonIter SoonIter changed the title 将 plugin-llms 中的 LlmsViewOptions 等组件内置到 core 中 (vibe-kanban) feat(core): move Llms runtime components from plugin-llms to core/theme Jan 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 19, 2026

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 2 projects with changes.

📊 Quick Summary
Project Total Size Change
node 10.4 MB -78.3 KB (-0.7%)
web 15.9 MB +1.1 KB (0.0%)
node_md 1.3 MB 0
📋 Detailed Reports (Click to expand)

📁 node

Path: website/doc_build/diff-rsdoctor/node/rsdoctor-data.json

📌 Baseline Commit: c2dff24ace | PR: #3025

Metric Current Baseline Change
📊 Total Size 10.4 MB 10.5 MB -78.3 KB (-0.7%)
📄 JavaScript 0 B 0 B 0
🎨 CSS 0 B 0 B 0
🌐 HTML 10.4 MB 10.5 MB -78.3 KB (-0.7%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: node Bundle Diff

📁 web

Path: website/doc_build/diff-rsdoctor/web/rsdoctor-data.json

📌 Baseline Commit: c2dff24ace | PR: #3025

Metric Current Baseline Change
📊 Total Size 15.9 MB 15.9 MB +1.1 KB (0.0%)
📄 JavaScript 15.1 MB 15.1 MB +314.0 B (0.0%)
🎨 CSS 126.6 KB 125.9 KB +690.0 B (0.5%)
🌐 HTML 0 B 0 B 0
📁 Other Assets 726.0 KB 725.9 KB +83.0 B (0.0%)

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request moves LLMS-related components (LlmsViewOptions, LlmsCopyButton, LlmsContainer, and useMdUrl) from the @rspress/plugin-llms package to the @rspress/core theme package to make them built-in components. This refactoring eliminates the need for SASS and CSS modules in the plugin package.

Changes:

  • Moved LLMS components from plugin-llms to core/theme/components/Llms
  • Converted from SCSS modules to standard SCSS with BEM-style class names
  • Removed @rsbuild/plugin-sass dependency from plugin-llms
  • Re-exported components from plugin-llms for backward compatibility

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-lock.yaml Removed @rsbuild/plugin-sass dependency from plugin-llms
packages/plugin-llms/package.json Removed @rsbuild/plugin-sass from devDependencies
packages/plugin-llms/rslib.config.ts Removed sass plugin, CSS module config, and BannerPlugin; added @rspress/core/theme to externals
packages/plugin-llms/src/runtime/index.tsx Changed to re-export all components from @rspress/core/theme
packages/plugin-llms/src/runtime/useMdUrl.ts Deleted - moved to core
packages/plugin-llms/src/runtime/env.d.ts Deleted - no longer needed without SCSS modules
packages/plugin-llms/src/runtime/LlmsViewOptions.module.scss Deleted - moved to core as standard SCSS
packages/plugin-llms/src/runtime/LlmsCopyButton.module.scss Deleted - moved to core as standard SCSS
packages/plugin-llms/src/runtime/IconCopy.tsx Deleted - using existing IconCopy from core
packages/core/src/theme/index.ts Added exports for all LLMS components
packages/core/src/theme/components/Llms/index.tsx New export file for LLMS components
packages/core/src/theme/components/Llms/index.scss New shared styles for LLMS button base class
packages/core/src/theme/components/Llms/LlmsViewOptions.tsx Moved from plugin, converted to use BEM classes and core icons
packages/core/src/theme/components/Llms/LlmsViewOptions.scss New styles file with BEM naming
packages/core/src/theme/components/Llms/LlmsCopyButton.tsx Moved from plugin, converted to use BEM classes and core icons
packages/core/src/theme/components/Llms/LlmsCopyButton.scss New styles file with BEM naming
packages/core/src/theme/components/Llms/LlmsContainer.tsx Moved from plugin, simplified to use BEM class
packages/core/src/theme/components/Llms/LlmsContainer.scss Updated class name to BEM format
packages/core/src/theme/components/Llms/useMdUrl.ts Moved from plugin, now uses routePathToMdPath from core/runtime
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)

packages/core/src/theme/components/Llms/LlmsViewOptions.tsx:168

  • The SVG icon for ChatGPT contains a duplicate path element. Both line 167 and line 168 have identical path data. This is unnecessary duplication and should be removed. Only one path element is needed.
    packages/core/src/theme/components/Llms/LlmsViewOptions.tsx:200
  • The button element is missing the type="button" attribute. Without this attribute, the button defaults to type="submit", which could cause unintended form submissions if this component is used within a form context. Add type="button" to make the behavior explicit.
    packages/core/src/theme/components/Llms/LlmsViewOptions.tsx:245
  • Using a div element with an onClick handler is not accessible for keyboard navigation. This element should be a button with type="button" to ensure it's keyboard accessible and properly announced to screen readers. Alternatively, add role="button", tabIndex={0}, and handle keyboard events (Enter/Space keys).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 19, 2026

@SoonIter I've opened a new pull request, #3027, to work on those changes. Once the pull request is ready, I'll request review from you.

…3027)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@SoonIter SoonIter requested a review from Timeless0911 January 19, 2026 10:57
@SoonIter SoonIter enabled auto-merge (squash) January 19, 2026 10:57
@SoonIter SoonIter merged commit bcfdcf5 into main Jan 19, 2026
8 checks passed
@SoonIter SoonIter deleted the syt-vibe-kanban/4c18-plugin-llms-llms branch January 19, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants