Skip to content

Commit 05b5e5f

Browse files
committed
Improvements
1 parent c466e40 commit 05b5e5f

24 files changed

+1619
-22
lines changed

cli.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"aliases": {
3+
"uiDir": "./components/ui",
4+
"componentsDir": "./components",
5+
"blockDir": "./components",
6+
"cssDir": "./styles",
7+
"libDir": "./lib"
8+
},
9+
"baseDir": "src",
10+
"commands": {}
11+
}
51.5 KB
Loading

content/docs/getting-started.mdx

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,42 @@ Welcome! Let's start by installing `os-compiler`, which will be referenced later
88
Compiler is required for you to easily compile your OS and apps source code, add kernel and all the needed libraries, and make the final binaries.
99

1010
Start by downloading latest [os-compiler](https://github.com/CatCoreV/os-compiler) release from **GitHub** either manually or via terminal:
11-
```bash
12-
topcatto@CAT-PC:~ $ git clone --branch v0.0.1 https://github.com/CatCoreV/os-compiler.git
13-
```
14-
15-
After that, enter `os-compiler` folder and run install script depending on your host OS.
1611

1712
```bash
18-
topcatto@CAT-PC:~ $ cd os-compiler
13+
git clone --branch v0.0.1 https://github.com/CatCoreV/os-compiler.git
1914
```
2015

21-
```bash
22-
# Windows
23-
D:\os-compiler> .\install-windows
24-
25-
# Linux / MacOS
26-
topcatto@CAT-PC:~/os-compiler $ chmod +x install-unix.sh && ./install-unix.sh
27-
```
2816

29-
Now, just open `catcore_compiler` / `catcore_compiler.exe` / `Catcore Compiler` depending on your host OS.
17+
After that, enter `os-compiler` folder and run install script depending on your host OS:
18+
19+
<Tabs groupId="hostos" items={["Windows", "Linux", "MacOS"]} persist>
20+
<Tab value="Windows">
21+
```bash
22+
.\install-windows
23+
```
24+
</Tab>
25+
<Tab value="Linux">
26+
```bash
27+
chmod +x install-unix.sh && ./install-unix.sh
28+
```
29+
</Tab>
30+
<Tab value="MacOS">
31+
```bash
32+
chmod +x install-unix.sh && ./install-unix.sh
33+
```
34+
</Tab>
35+
</Tabs>
36+
37+
<Tabs groupId="hostos" items={["Windows", "Linux", "MacOS"]} persist>
38+
<Tab value="Windows">
39+
Now, just open `catcore_compiler.exe` to open compiler GUI:
40+
</Tab>
41+
<Tab value="Linux">
42+
Now, just open `catcore_compiler` to open compiler GUI:
43+
</Tab>
44+
<Tab value="MacOS">
45+
Now, just open `Catcore Compiler` to open compiler GUI:
46+
</Tab>
47+
</Tabs>
48+
49+
<img src="catcore_compiler_gui.png" />

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,22 @@
1212
},
1313
"dependencies": {
1414
"@orama/orama": "^3.1.17",
15+
"@radix-ui/react-accordion": "^1.2.12",
16+
"@radix-ui/react-collapsible": "^1.1.12",
17+
"@radix-ui/react-tabs": "^1.1.13",
18+
"class-variance-authority": "^0.7.1",
19+
"d3-force": "^3.0.0",
1520
"fumadocs-core": "16.2.5",
1621
"fumadocs-mdx": "14.1.1",
22+
"fumadocs-typescript": "^4.0.14",
1723
"fumadocs-ui": "16.2.5",
1824
"lucide-react": "^0.556.0",
1925
"next": "16.0.10",
2026
"react": "^19.2.1",
21-
"react-dom": "^19.2.1"
27+
"react-dom": "^19.2.1",
28+
"react-force-graph-2d": "^1.29.0",
29+
"react-medium-image-zoom": "^5.4.0",
30+
"tailwind-merge": "^3.4.0"
2231
},
2332
"devDependencies": {
2433
"@tailwindcss/postcss": "^4.1.17",

source.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { defineConfig, defineDocs, frontmatterSchema, metaSchema } from "fumadocs-mdx/config";
2+
import { remarkMdxFiles } from "fumadocs-core/mdx-plugins";
23

34
export const docs = defineDocs({
45
"dir": "content/docs",
56
"docs": {
67
"schema": frontmatterSchema,
78
"postprocess": {
8-
"includeProcessedMarkdown": true
9+
"includeProcessedMarkdown": true,
10+
"extractLinkReferences": true
911
}
1012
},
1113
"meta": {
@@ -14,5 +16,7 @@ export const docs = defineDocs({
1416
});
1517

1618
export default defineConfig({
17-
"mdxOptions": {}
19+
"mdxOptions": {
20+
"remarkPlugins": [remarkMdxFiles]
21+
}
1822
});

src/app/[lang]/docs/layout.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
22
import { source } from "@/lib/source";
33
import { DocsLayout } from "fumadocs-ui/layouts/docs";
44
import { baseOptions } from "@/lib/layout.shared";
5+
import { GithubInfo } from "fumadocs-ui/components/github-info";
56

67
export default async function Layout({ params, children }: {
78
params: Promise<{ lang: string }>;
@@ -10,7 +11,16 @@ export default async function Layout({ params, children }: {
1011
const { lang } = await params;
1112

1213
return (
13-
<DocsLayout tree={source.getPageTree(lang)} {...baseOptions()}>
14+
<DocsLayout tree={source.getPageTree(lang)} {...baseOptions()} links={[
15+
{
16+
"type": "custom",
17+
"children": <GithubInfo owner="CatCoreV" repo="catcore" className="lg:-mx-2" />,
18+
},
19+
{
20+
"type": "custom",
21+
"children": <GithubInfo owner="CatCoreV" repo="os-compiler" className="lg:-mx-2" />,
22+
}
23+
]}>
1424
{children}
1525
</DocsLayout>
1626
);

src/app/global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@import "tailwindcss";
2-
@import "fumadocs-ui/css/neutral.css";
2+
@import "fumadocs-ui/css/purple.css";
33
@import "fumadocs-ui/css/preset.css";

src/components/accordion.tsx

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
'use client';
2+
3+
import type {
4+
AccordionMultipleProps,
5+
AccordionSingleProps,
6+
} from '@radix-ui/react-accordion';
7+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
8+
import { Check, ChevronRight, Link as LinkIcon } from 'lucide-react';
9+
import {
10+
type ComponentPropsWithoutRef,
11+
forwardRef,
12+
type ReactNode,
13+
useEffect,
14+
useRef,
15+
useState,
16+
} from 'react';
17+
import { cn } from '../lib/cn';
18+
import { useCopyButton } from 'fumadocs-ui/utils/use-copy-button';
19+
import { buttonVariants } from './ui/button';
20+
import { mergeRefs } from '../lib/merge-refs';
21+
22+
export const Accordions = forwardRef<
23+
HTMLDivElement,
24+
| Omit<AccordionSingleProps, 'value' | 'onValueChange'>
25+
| Omit<AccordionMultipleProps, 'value' | 'onValueChange'>
26+
>(({ type = 'single', className, defaultValue, ...props }, ref) => {
27+
const rootRef = useRef<HTMLDivElement>(null);
28+
const composedRef = mergeRefs(ref, rootRef);
29+
const [value, setValue] = useState<string | string[]>(() =>
30+
type === 'single' ? (defaultValue ?? '') : (defaultValue ?? []),
31+
);
32+
33+
useEffect(() => {
34+
const id = window.location.hash.substring(1);
35+
const element = rootRef.current;
36+
if (!element || id.length === 0) return;
37+
38+
const selected = document.getElementById(id);
39+
if (!selected || !element.contains(selected)) return;
40+
const value = selected.getAttribute('data-accordion-value');
41+
42+
if (value)
43+
setValue((prev) => (typeof prev === 'string' ? value : [value, ...prev]));
44+
}, []);
45+
46+
return (
47+
// @ts-expect-error -- Multiple types
48+
<AccordionPrimitive.Root
49+
type={type}
50+
ref={composedRef}
51+
value={value}
52+
onValueChange={setValue}
53+
collapsible={type === 'single' ? true : undefined}
54+
className={cn(
55+
'divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card',
56+
className,
57+
)}
58+
{...props}
59+
/>
60+
);
61+
});
62+
63+
Accordions.displayName = 'Accordions';
64+
65+
export const Accordion = forwardRef<
66+
HTMLDivElement,
67+
Omit<
68+
ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>,
69+
'value' | 'title'
70+
> & {
71+
title: string | ReactNode;
72+
value?: string;
73+
}
74+
>(
75+
(
76+
{ title, className, id, value = String(title), children, ...props },
77+
ref,
78+
) => {
79+
return (
80+
<AccordionPrimitive.Item
81+
ref={ref}
82+
value={value}
83+
className={cn('scroll-m-24', className)}
84+
{...props}
85+
>
86+
<AccordionPrimitive.Header
87+
id={id}
88+
data-accordion-value={value}
89+
className="not-prose flex flex-row items-center text-fd-card-foreground font-medium has-focus-visible:bg-fd-accent"
90+
>
91+
<AccordionPrimitive.Trigger className="group flex flex-1 items-center gap-2 px-3 py-2.5 text-start focus-visible:outline-none">
92+
<ChevronRight className="size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-90" />
93+
{title}
94+
</AccordionPrimitive.Trigger>
95+
{id ? <CopyButton id={id} /> : null}
96+
</AccordionPrimitive.Header>
97+
<AccordionPrimitive.Content className="overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down">
98+
<div className="px-4 pb-2 text-[0.9375rem] prose-no-margin">
99+
{children}
100+
</div>
101+
</AccordionPrimitive.Content>
102+
</AccordionPrimitive.Item>
103+
);
104+
},
105+
);
106+
107+
function CopyButton({ id }: { id: string }) {
108+
const [checked, onClick] = useCopyButton(() => {
109+
const url = new URL(window.location.href);
110+
url.hash = id;
111+
112+
return navigator.clipboard.writeText(url.toString());
113+
});
114+
115+
return (
116+
<button
117+
type="button"
118+
aria-label="Copy Link"
119+
className={cn(
120+
buttonVariants({
121+
color: 'ghost',
122+
className: 'text-fd-muted-foreground me-2',
123+
}),
124+
)}
125+
onClick={onClick}
126+
>
127+
{checked ? (
128+
<Check className="size-3.5" />
129+
) : (
130+
<LinkIcon className="size-3.5" />
131+
)}
132+
</button>
133+
);
134+
}
135+
136+
Accordion.displayName = 'Accordion';

0 commit comments

Comments
 (0)