@marlinjai/clearify 1.6.0 → 1.6.2
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
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;
|
|
@@ -152,8 +189,14 @@ export function Sidebar({ sections, open, onClose }: SidebarProps) {
|
|
|
152
189
|
});
|
|
153
190
|
};
|
|
154
191
|
|
|
155
|
-
const handleExpandAll = () =>
|
|
156
|
-
|
|
192
|
+
const handleExpandAll = () => {
|
|
193
|
+
setExpandedGroups(new Set(allGroupKeys));
|
|
194
|
+
window.dispatchEvent(new CustomEvent('clearify:expand-all'));
|
|
195
|
+
};
|
|
196
|
+
const handleCollapseAll = () => {
|
|
197
|
+
setExpandedGroups(new Set());
|
|
198
|
+
window.dispatchEvent(new CustomEvent('clearify:collapse-all'));
|
|
199
|
+
};
|
|
157
200
|
|
|
158
201
|
return (
|
|
159
202
|
<>
|
|
@@ -279,6 +322,23 @@ export function Sidebar({ sections, open, onClose }: SidebarProps) {
|
|
|
279
322
|
/>
|
|
280
323
|
))}
|
|
281
324
|
</nav>
|
|
325
|
+
|
|
326
|
+
{/* Resize handle */}
|
|
327
|
+
<div
|
|
328
|
+
onMouseDown={(e) => { e.preventDefault(); setIsResizing(true); }}
|
|
329
|
+
className="clearify-sidebar-resize"
|
|
330
|
+
style={{
|
|
331
|
+
position: 'absolute',
|
|
332
|
+
right: 0,
|
|
333
|
+
top: 0,
|
|
334
|
+
bottom: 0,
|
|
335
|
+
width: '5px',
|
|
336
|
+
cursor: 'col-resize',
|
|
337
|
+
background: isResizing ? 'var(--clearify-primary)' : 'transparent',
|
|
338
|
+
transition: isResizing ? 'none' : 'background 0.15s ease',
|
|
339
|
+
zIndex: 10,
|
|
340
|
+
}}
|
|
341
|
+
/>
|
|
282
342
|
</aside>
|
|
283
343
|
|
|
284
344
|
<style>{`
|
|
@@ -298,6 +358,12 @@ export function Sidebar({ sections, open, onClose }: SidebarProps) {
|
|
|
298
358
|
.clearify-menu-btn {
|
|
299
359
|
display: flex !important;
|
|
300
360
|
}
|
|
361
|
+
.clearify-sidebar-resize {
|
|
362
|
+
display: none !important;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
.clearify-sidebar-resize:hover {
|
|
366
|
+
background: var(--clearify-border-strong) !important;
|
|
301
367
|
}
|
|
302
368
|
`}</style>
|
|
303
369
|
</>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { OperationCard } from './OperationCard.js';
|
|
3
3
|
|
|
4
4
|
interface TagGroupProps {
|
|
@@ -17,6 +17,17 @@ function operationAnchorId(tag: string, method: string, path: string): string {
|
|
|
17
17
|
export function TagGroup({ tag, description, operations, baseUrl }: TagGroupProps) {
|
|
18
18
|
const [expanded, setExpanded] = useState(true);
|
|
19
19
|
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const onExpand = () => setExpanded(true);
|
|
22
|
+
const onCollapse = () => setExpanded(false);
|
|
23
|
+
window.addEventListener('clearify:expand-all', onExpand);
|
|
24
|
+
window.addEventListener('clearify:collapse-all', onCollapse);
|
|
25
|
+
return () => {
|
|
26
|
+
window.removeEventListener('clearify:expand-all', onExpand);
|
|
27
|
+
window.removeEventListener('clearify:collapse-all', onCollapse);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
20
31
|
return (
|
|
21
32
|
<div
|
|
22
33
|
id={`tag/${encodeURIComponent(tag)}`}
|