@rspress-theme-anatole/theme-default 0.1.30 → 0.2.0

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/config.ts CHANGED
@@ -1,6 +1,4 @@
1
- import * as path from 'node:path';
2
1
  import type { UserConfig } from '@rspress-theme-anatole/shared';
3
- import directives from '@rspress-theme-anatole/rspress-plugin-directives';
4
2
  import mermaid from "@rspress-theme-anatole/rspress-plugin-mermaid";
5
3
 
6
4
  export function defineConfig(config: UserConfig): UserConfig {
@@ -15,14 +13,6 @@ export function defineConfig(config: UserConfig): UserConfig {
15
13
  dark: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALkAAAAiCAYAAAADDHjcAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAuaADAAQAAAABAAAAIgAAAAAaLefbAAAONElEQVR4Ae2cC5RVVRnHz7kDMyAJIg9FEBBzaVGIaSgJw4AKM2im+Sy0pTwUTaEyDLQIEFFRysSVLZVlS8V8raxMBnk5gyKgAZKRrwBTFJgZkKeAzNzT739n7zvn3nvOnTsvGlz3W+t/9vfar+98Z5999h1wnCxlI5CNQDYC2Qgc3hFwG2P45YWDZnY8snSS+5xTFdSeV/TVvPLKbl+TrdOeA++5y5fvC/LL6rIRaIoIRBraaMXQglM815lQsWvgtclteY7jlhUNvKnM67rDaeGtEcrbtdy5tXDQBNmS/bNyNgJNEYEGJ3lVxJuhgXmuO9nr3TvXP8iKooHjHScy23WdVnG967ZEnllti2uzTDYCTRaBBq2mW4cNONWN5LxVM7rozZ2LX31Q8mcFBUd90crbREK3qbHXcJ7n7M3d73ZrX1Kyo0ab5bIRaPwINGgld93InYlDitzuFRTEVu2DeZVnhSW46shW1bqqILF+VspGoPEjUO8krxg2sB+Zen7SkI6taB39cZIuVGQ1r9nGhHplDdkINCwC9U7yaMS9I6jrqOdO2jK0Tx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ElFTkSuQmCC',
16
14
  },
17
15
  plugins: [
18
- // directives({
19
- // directive: 'tabs',
20
- // transformer: {
21
- // type: 'globalComponent',
22
- // getComponentName: (meta) => 'Tabs',
23
- // componentPath: path.join(__dirname, './components/tabs.tsx'),
24
- // },
25
- // }),
26
16
  mermaid({
27
17
  mermaidConfig: {
28
18
  theme: "forest",
package/dist/bundle.css CHANGED
@@ -582,8 +582,8 @@ span.code-line-highlighted {
582
582
  }
583
583
 
584
584
  :is(.content_ff766 .rspress-doc, .content_ff766 .rspress-doc-footer) {
585
- max-width: min(100%, 992px);
586
- margin: auto;
585
+ /* max-width: min(100%, 992px); */
586
+ /* margin: auto; */
587
587
  padding: 0 64px;
588
588
  }
589
589
  }
package/dist/bundle.js CHANGED
@@ -2745,7 +2745,7 @@ function HomeFooter() {
2745
2745
  children: [
2746
2746
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
2747
2747
  dangerouslySetInnerHTML: {
2748
- __html: group.map((groupItem) => { return `<span class="">${groupItem.text}</span>` }).join("")
2748
+ __html: group && group.map((groupItem) => { return `<span class="">${groupItem.text}</span>` }).join("")
2749
2749
  },
2750
2750
  style: {
2751
2751
  gap: "20px",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rspress-theme-anatole/theme-default",
3
3
  "author": "Anatole Tong",
4
- "version": "0.1.30",
4
+ "version": "0.2.0",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
7
7
  "*.css",
@@ -21,8 +21,8 @@
21
21
  "types": "./dist/bundle.d.ts",
22
22
  "dependencies": {
23
23
  "@mdx-js/react": "2.3.0",
24
- "@rspress-theme-anatole/rspress-plugin-directives": "0.1.30",
25
- "@rspress-theme-anatole/shared": "0.1.30",
24
+ "@rspress-theme-anatole/rspress-plugin-directives": "0.2.0",
25
+ "@rspress-theme-anatole/shared": "0.2.0",
26
26
  "@rspress/runtime": "1.43.8",
27
27
  "body-scroll-lock": "4.0.0-beta.0",
28
28
  "copy-to-clipboard": "^3.3.3",
@@ -36,7 +36,7 @@
36
36
  "react-helmet-async": "^1.3.0",
37
37
  "react-router-dom": "6.29.0",
38
38
  "react-syntax-highlighter": "^15.6.1",
39
- "@rspress-theme-anatole/rspress-plugin-mermaid": "0.1.30"
39
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.2.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@microsoft/api-extractor": "^7.49.2",
@@ -1,239 +0,0 @@
1
- import React, { useState, useEffect, Children, isValidElement } from 'react';
2
- // import ReactDOMServer from 'react-dom/server';
3
- import { usePageData } from '@rspress/runtime';
4
-
5
- interface TabItem {
6
- label: string;
7
- content: React.ReactNode;
8
- }
9
-
10
- interface TabsProps {
11
- children: React.ReactNode;
12
- }
13
-
14
- export const Tabs: React.FC<TabsProps> = ({ children }) => {
15
- // console.log(children);
16
- const outputItems: TabItem[] = [];
17
-
18
- // const convertToHTML = (node: any): string => {
19
- // // console.log(node);
20
- // if (node === null || node === undefined) return '';
21
-
22
- // if (typeof node === 'string' || typeof node === 'number') {
23
- // return String(node);
24
- // }
25
-
26
- // if (Array.isArray(node)) {
27
- // return node.map(item => {
28
- // return convertToHTML(item);
29
- // }
30
- // ).join('');
31
- // }
32
-
33
- // if (isValidElement(node)) {
34
- // const element = node as React.ReactElement;
35
- // const props = element.props as Record<string, any>;
36
-
37
- // if (element.type === React.Fragment) {
38
- // return convertToHTML(props.children);
39
- // }
40
-
41
- // if (typeof element.type === 'string') {
42
- // // Build attributes string
43
- // const attributes = Object.entries(props)
44
- // .filter(([key]) => key !== 'children' && key !== 'className')
45
- // .map(([key, value]) => `${key}="${value}"`)
46
- // .concat(props.className ? [`class="${props.className}"`] : [])
47
- // .join(' ');
48
-
49
- // const attributeString = attributes ? ` ${attributes}` : '';
50
-
51
- // // Convert children to HTML
52
- // const childrenContent = props.children ? convertToHTML(props.children) : '';
53
-
54
- // // Handle void elements
55
- // const voidElements = ['img', 'br', 'hr', 'input', 'meta', 'link'];
56
- // if (voidElements.includes(element.type)) {
57
- // return `<${element.type}${attributeString}>`;
58
- // }
59
-
60
- // // Handle regular elements
61
- // return `<${element.type}${attributeString}>${childrenContent}</${element.type}>`;
62
- // }
63
-
64
- // try {
65
- // return ReactDOMServer.renderToStaticMarkup(element);
66
- // } catch (error) {
67
- // // return convertToHTML(props.children);
68
- // if (element) {
69
- // const modifiedElement = {
70
- // ...element,
71
- // props: {
72
- // ...(typeof element.props === 'object' && element.props !== null ? element.props : {}),
73
- // children: DealWithUrl(props.children)
74
- // }
75
- // };
76
-
77
- // // console.log(modifiedElement);
78
- // if (modifiedElement) {
79
- // try {
80
- // return ReactDOMServer.renderToStaticMarkup(modifiedElement);
81
- // }
82
- // catch {
83
- // return convertToHTML(props.children);
84
- // }
85
- // }
86
- // }
87
- // }
88
- // }
89
-
90
- // // Handle objects with props (like context providers)
91
- // if (node && typeof node === 'object' && 'props' in node) {
92
- // return convertToHTML((node as any).props.children);
93
- // }
94
-
95
- // return '';
96
- // };
97
-
98
- // function DealWithUrl(para: any): any {
99
- // if (Array.isArray(para)) {
100
- // return para.map((child: any) => {
101
- // if (child && child.type) {
102
- // if ("href" in child.props) {
103
- // // console.log(child.props);
104
- // if (child.props.children === "#") {
105
- // return <a class={child.props.className} aria-hidden={child.props["aria-hidden"]} href={child.props.href}>#</a>;
106
- // }
107
- // else {
108
- // return child.props.children;
109
- // }
110
- // }
111
- // else if (child.props && child.props.children) {
112
- // return {
113
- // ...child,
114
- // props: {
115
- // ...child.props,
116
- // children: DealWithUrl(child.props.children)
117
- // }
118
- // };
119
- // }
120
- // }
121
- // return child;
122
- // });
123
- // } else {
124
- // return para;
125
- // }
126
- // }
127
-
128
- // function convertUrlsToLinks(content: string) {
129
- // const urlPattern = /(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/g;
130
- // return content.replace(urlPattern, function (url) {
131
- // return `<a href="${encodeURI(url)}" target="_blank">${url}</a>`;
132
- // });
133
- // }
134
-
135
- const parseTabs = (inputItems: React.ReactNode): TabItem[] => {
136
- Children.forEach(inputItems, (inputItem) => {
137
- if (isValidElement<{ children: React.ReactNode }>(inputItem)) {
138
- if (typeof inputItem.props.children === 'string') {
139
- const text: string = inputItem.props.children;
140
- if (text.startsWith('==')) {
141
- if (text.includes('\r\n')) {
142
- let match = text.split('\r\n', 2);
143
- var tabItem: TabItem = {
144
- label: match[0].split('==').filter(Boolean)[0],
145
- content: text.substring(match[0].length).trim()
146
- };
147
- }
148
- else {
149
- var tabItem: TabItem = {
150
- label: text.split('==').filter(Boolean)[0],
151
- content: ''
152
- };
153
- }
154
-
155
- outputItems.push(tabItem);
156
- }
157
- else {
158
- const lastTab = outputItems[outputItems.length - 1];
159
- if (lastTab) {
160
- lastTab.content = <>{lastTab.content}{inputItem}</>;
161
- }
162
- }
163
- }
164
- else {
165
- const lastTab = outputItems[outputItems.length - 1];
166
- if (lastTab) {
167
- lastTab.content = <>{lastTab.content}{inputItem}</>;
168
- }
169
- }
170
- }
171
- });
172
- return outputItems;
173
- };
174
-
175
- const tabs = parseTabs(children);
176
- const [activeTab, setActiveTab] = useState(tabs[0]?.label);
177
-
178
- if (!tabs.length) return null;
179
-
180
- return (
181
- <div className="tabs-container">
182
- <div className="tabs-header">
183
- {tabs.map((tab) => (
184
- <button
185
- key={tab.label}
186
- className={`tab-button ${activeTab === tab.label ? 'active' : ''}`}
187
- onClick={() => setActiveTab(tab.label)}
188
- >
189
- {tab.label}
190
- </button>
191
- ))}
192
- </div>
193
- <div className="tabs-content">
194
- {tabs.find((tab) => tab.label === activeTab)?.content}
195
- </div>
196
-
197
- <style>{`
198
- .tabs-container {
199
- margin: 1rem 0;
200
- border: 1px solid #e5e7eb;
201
- border-radius: 0.375rem;
202
- }
203
- .tabs-header {
204
- display: flex;
205
- border-bottom: 1px solid #e5e7eb;
206
- background-color: #f9fafb;
207
- border-top-left-radius: 0.375rem;
208
- border-top-right-radius: 0.375rem;
209
- }
210
- .tab-button {
211
- padding: 0.75rem 1.25rem;
212
- border: none;
213
- background: none;
214
- cursor: pointer;
215
- font-size: 0.875rem;
216
- color: #4b5563;
217
- border-right: 1px solid #e5e7eb;
218
- }
219
- .tab-button:hover {
220
- background-color: #f3f4f6;
221
- }
222
- .tab-button.active {
223
- color: #1e40af;
224
- background-color: #fff;
225
- border-bottom: 2px solid #1e40af;
226
- margin-bottom: -1px;
227
- }
228
- .tabs-content {
229
- padding: 1rem;
230
- background-color: #fff;
231
- border-bottom-left-radius: 0.375rem;
232
- border-bottom-right-radius: 0.375rem;
233
- }
234
- `}</style>
235
- </div>
236
- );
237
- };
238
-
239
- export default Tabs;