Skip to content

Commit 525e419

Browse files
committed
feat: ruler components, demo tutorial and some more docs
1 parent 736f14d commit 525e419

File tree

17 files changed

+2259
-24
lines changed

17 files changed

+2259
-24
lines changed

.changeset/eighty-pumas-drive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@coord/graph": minor
3+
---
4+
5+
Implements Ruler component

packages/core/src/math/vec2.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ export class Vec2 {
7777
abs() {
7878
return point(Math.abs(this.x), Math.abs(this.y));
7979
}
80+
81+
normalize() {
82+
const length = this.length();
83+
return point(this.x / length, this.y / length);
84+
}
85+
86+
normal() {
87+
return point(-this.y, this.x);
88+
}
8089
}
8190

8291
export function point(x: number, y: number) {

packages/docs/next.config.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import rehypeMdxCodeProps from "rehype-mdx-code-props";
22
import remarkGfm from "remark-gfm";
3-
3+
import rehypeKatex from "rehype-katex";
4+
import remarkMath from "remark-math";
45
/** @type {import('next').NextConfig} */
56
const nextConfig = {
67
experimental: {
@@ -10,8 +11,8 @@ const nextConfig = {
1011
import mdx from "@next/mdx";
1112
const withMDX = mdx({
1213
options: {
13-
remarkPlugins: [remarkGfm],
14-
rehypePlugins: [rehypeMdxCodeProps],
14+
remarkPlugins: [remarkGfm, remarkMath],
15+
rehypePlugins: [rehypeMdxCodeProps, rehypeKatex],
1516
useDynamicImport: true,
1617
},
1718
});

packages/docs/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
"@mdx-js/react": "^2.3.0",
1616
"@next/mdx": "^13.4.4",
1717
"@types/mdx": "^2.0.5",
18+
"katex": "^0.16.7",
1819
"next": "^13.4.4",
1920
"next-mdx-remote": "^4.4.1",
2021
"react": "^18.2.0",
2122
"react-dom": "^18.2.0",
2223
"react-icons": "^4.9.0",
24+
"rehype-katex": "^6.0.3",
2325
"rehype-mdx-code-props": "^1.0.0",
24-
"remark-gfm": "^3.0.1"
26+
"remark-gfm": "^3.0.1",
27+
"remark-math": "^5.1.1"
2528
},
2629
"devDependencies": {
2730
"@coord/graph": "workspace:*",

packages/docs/src/app/graph/docs/[[...slug]]/layout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Sidebar } from "@/components/Sidebar";
22
import { getRoute, getRoutes } from "@/content/graph/docs/routeMaps";
3+
34
import Link from "next/link";
5+
import "katex/dist/katex.min.css";
46

57
import { GoChevronRight, GoChevronLeft } from "react-icons/go";
68

@@ -16,7 +18,7 @@ export default function Layout(props: {
1618
const prevRoute = routeDetails.prev ? getRoute(routeDetails.prev) : null;
1719

1820
return (
19-
<div className="mx-auto flex h-full w-full max-w-6xl flex-grow flex-col md:flex-row ">
21+
<div className="mx-auto flex h-full w-full max-w-6xl flex-grow flex-col md:flex-row [&_.math]:text-white">
2022
<Sidebar items={getRoutes()} />
2123
<div className="mx-auto flex w-full max-w-6xl">
2224
<div className="w-full px-4 py-4">

packages/docs/src/components/PreMdx.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export function PreMdx({
88
}: {
99
children: React.ReactNode;
1010
live?: boolean;
11+
previewOnly?: boolean;
1112
collapsed?: boolean;
1213
className?: string;
1314
}) {

0 commit comments

Comments
 (0)