@marlinjai/clearify 1.6.0 → 1.6.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/theme/Sidebar.tsx +60 -0
- package/src/theme/styles/globals.css +6 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ An open-source documentation site generator. Turn markdown into beautiful docs.
|
|
|
11
11
|
- **Dark mode** — automatic light/dark theme switching
|
|
12
12
|
- **Syntax highlighting** — beautiful code blocks with Shiki (dual light/dark themes)
|
|
13
13
|
- **SSG & SEO** — pre-rendered HTML, Open Graph, Twitter Cards, JSON-LD, sitemap, robots.txt
|
|
14
|
-
- **OpenAPI
|
|
14
|
+
- **OpenAPI API Reference** — custom-built renderer for OpenAPI specs with code examples, schema viewer, and full design system integration
|
|
15
15
|
- **Multi-section support** — pill-based section switcher (e.g. public docs + internal docs)
|
|
16
16
|
- **Auto changelog** — drop a `CHANGELOG.md` in your project root, it appears as `/changelog`
|
|
17
17
|
|
package/package.json
CHANGED
package/src/theme/Sidebar.tsx
CHANGED
|
@@ -109,6 +109,43 @@ export function Sidebar({ sections, open, onClose }: SidebarProps) {
|
|
|
109
109
|
}, [location.pathname, sections, isSectionData]);
|
|
110
110
|
|
|
111
111
|
const sidebarRef = useRef<HTMLElement>(null);
|
|
112
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
113
|
+
|
|
114
|
+
// Restore saved sidebar width on mount
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const saved = localStorage.getItem('clearify-sidebar-width');
|
|
117
|
+
if (saved) {
|
|
118
|
+
document.documentElement.style.setProperty('--clearify-sidebar-width', saved);
|
|
119
|
+
}
|
|
120
|
+
}, []);
|
|
121
|
+
|
|
122
|
+
// Resize drag logic
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (!isResizing) return;
|
|
125
|
+
|
|
126
|
+
const handleMouseMove = (e: MouseEvent) => {
|
|
127
|
+
const newWidth = Math.max(200, Math.min(500, e.clientX));
|
|
128
|
+
document.documentElement.style.setProperty('--clearify-sidebar-width', `${newWidth}px`);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const handleMouseUp = () => {
|
|
132
|
+
setIsResizing(false);
|
|
133
|
+
document.body.style.cursor = '';
|
|
134
|
+
document.body.style.userSelect = '';
|
|
135
|
+
const width = getComputedStyle(document.documentElement).getPropertyValue('--clearify-sidebar-width').trim();
|
|
136
|
+
localStorage.setItem('clearify-sidebar-width', width);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
document.body.style.cursor = 'col-resize';
|
|
140
|
+
document.body.style.userSelect = 'none';
|
|
141
|
+
window.addEventListener('mousemove', handleMouseMove);
|
|
142
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
143
|
+
|
|
144
|
+
return () => {
|
|
145
|
+
window.removeEventListener('mousemove', handleMouseMove);
|
|
146
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
147
|
+
};
|
|
148
|
+
}, [isResizing]);
|
|
112
149
|
|
|
113
150
|
useEffect(() => {
|
|
114
151
|
const sidebar = sidebarRef.current;
|
|
@@ -279,6 +316,23 @@ export function Sidebar({ sections, open, onClose }: SidebarProps) {
|
|
|
279
316
|
/>
|
|
280
317
|
))}
|
|
281
318
|
</nav>
|
|
319
|
+
|
|
320
|
+
{/* Resize handle */}
|
|
321
|
+
<div
|
|
322
|
+
onMouseDown={(e) => { e.preventDefault(); setIsResizing(true); }}
|
|
323
|
+
className="clearify-sidebar-resize"
|
|
324
|
+
style={{
|
|
325
|
+
position: 'absolute',
|
|
326
|
+
right: 0,
|
|
327
|
+
top: 0,
|
|
328
|
+
bottom: 0,
|
|
329
|
+
width: '5px',
|
|
330
|
+
cursor: 'col-resize',
|
|
331
|
+
background: isResizing ? 'var(--clearify-primary)' : 'transparent',
|
|
332
|
+
transition: isResizing ? 'none' : 'background 0.15s ease',
|
|
333
|
+
zIndex: 10,
|
|
334
|
+
}}
|
|
335
|
+
/>
|
|
282
336
|
</aside>
|
|
283
337
|
|
|
284
338
|
<style>{`
|
|
@@ -298,6 +352,12 @@ export function Sidebar({ sections, open, onClose }: SidebarProps) {
|
|
|
298
352
|
.clearify-menu-btn {
|
|
299
353
|
display: flex !important;
|
|
300
354
|
}
|
|
355
|
+
.clearify-sidebar-resize {
|
|
356
|
+
display: none !important;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
.clearify-sidebar-resize:hover {
|
|
360
|
+
background: var(--clearify-border-strong) !important;
|
|
301
361
|
}
|
|
302
362
|
`}</style>
|
|
303
363
|
</>
|