diff --git a/package.json b/package.json index 013486c1..1e616a25 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "test:unit": "jest", "test:e2e": "tsx scripts/testgen.ts && playwright test", "build": "tsx scripts/build.ts", + "build:docs": "pnpm -s docgen && cd docs && pnpm -s build", "docgen": "tsx scripts/docgen.ts", "api-report:update": "pnpm tsc && api-extractor run --local", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", diff --git a/scripts/docgen.ts b/scripts/docgen.ts index 24ff1f39..99532c05 100644 --- a/scripts/docgen.ts +++ b/scripts/docgen.ts @@ -16,7 +16,7 @@ const writePath = path.join(projectRoot, "docs/generated-docgen.tsx") const contents = ` // prettier-ignore -const docgenInfo = ${JSON.stringify(docgenInfo)} as const; +const docgenInfo = ${JSON.stringify(docgenInfo, null, 2)} as const; export default docgenInfo; ` diff --git a/src/display/Plot.tsx b/src/display/Plot.tsx index 6e82b8c1..0f730e83 100644 --- a/src/display/Plot.tsx +++ b/src/display/Plot.tsx @@ -1,4 +1,5 @@ -import { OfX, OfY } from "./Plot/Simple" +import { OfX } from "./Plot/OfX" +import { OfY } from "./Plot/OfY" import { Parametric } from "./Plot/Parametric" import { VectorField } from "./Plot/VectorField" import { Inequality } from "./Plot/Inequality" @@ -12,7 +13,8 @@ export const Plot = { } import type { InequalityProps } from "./Plot/Inequality" -import type { OfXProps, OfYProps } from "./Plot/Simple" +import type { OfXProps } from "./Plot/OfX" +import type { OfYProps } from "./Plot/OfY" import type { ParametricProps } from "./Plot/Parametric" import type { VectorFieldProps } from "./Plot/VectorField" export type { InequalityProps, OfXProps, OfYProps, ParametricProps, VectorFieldProps } diff --git a/src/display/Plot/Simple.tsx b/src/display/Plot/OfX.tsx similarity index 57% rename from src/display/Plot/Simple.tsx rename to src/display/Plot/OfX.tsx index 7191e148..4e8cd138 100644 --- a/src/display/Plot/Simple.tsx +++ b/src/display/Plot/OfX.tsx @@ -20,21 +20,3 @@ export function OfX({ y, ...props }: OfXProps) { } OfX.displayName = "Plot.OfX" - -export interface OfYProps extends Omit { - x: (y: number) => number - svgPathProps?: React.SVGProps -} - -export function OfY({ x, ...props }: OfYProps) { - const { - yPaneRange: [yMin, yMax], - } = usePaneContext() - - const xy = React.useCallback((y) => [x(y), y], [x]) - const t = React.useMemo(() => [yMin, yMax], [yMin, yMax]) - - return -} - -OfY.displayName = "Plot.OfY" diff --git a/src/display/Plot/OfY.tsx b/src/display/Plot/OfY.tsx new file mode 100644 index 00000000..273ab363 --- /dev/null +++ b/src/display/Plot/OfY.tsx @@ -0,0 +1,22 @@ +import * as React from "react" +import { usePaneContext } from "../../context/PaneContext" +import { Parametric, ParametricProps } from "./Parametric" +import { vec } from "../../vec" + +export interface OfYProps extends Omit { + x: (y: number) => number + svgPathProps?: React.SVGProps +} + +export function OfY({ x, ...props }: OfYProps) { + const { + yPaneRange: [yMin, yMax], + } = usePaneContext() + + const xy = React.useCallback((y) => [x(y), y], [x]) + const t = React.useMemo(() => [yMin, yMax], [yMin, yMax]) + + return +} + +OfY.displayName = "Plot.OfY" diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000..0972529c --- /dev/null +++ b/vercel.json @@ -0,0 +1,4 @@ +{ + "buildCommand": "pnpm -s docgen && cd docs && pnpm -s build", + "outputDirectory": "docs/build" +}