import BezierDemo from "@/components/BezierDemo"; import BezierDemoPane from "@/components/BezierDemoPane"; import SubpathDemo from "@/components/SubpathDemo"; import SubpathDemoPane from "@/components/SubpathDemoPane"; import bezierFeatures, { BezierFeatureName } from "@/features/bezier-features"; import subpathFeatures, { SubpathFeatureName } from "@/features/subpath-features"; import "@/style.css"; window.document.title = "Bezier-rs Interactive Documentation"; window.document.body.innerHTML = `

Bezier-rs Interactive Documentation

This is the interactive documentation for the Bezier-rs library. View the crate documentation for detailed function descriptions and API usage. Click and drag on the endpoints of the demo curves to visualize the various Bezier utilities and functions.

Beziers

Subpaths

`.trim(); declare global { interface HTMLElementTagNameMap { "bezier-demo": BezierDemo; "bezier-demo-pane": BezierDemoPane; "subpath-demo": SubpathDemo; "subpath-demo-pane": SubpathDemoPane; } } window.customElements.define("bezier-demo", BezierDemo); window.customElements.define("bezier-demo-pane", BezierDemoPane); window.customElements.define("subpath-demo", SubpathDemo); window.customElements.define("subpath-demo-pane", SubpathDemoPane); const bezierDemos = document.getElementById("bezier-demos"); (Object.keys(bezierFeatures) as BezierFeatureName[]).forEach((featureName) => { const feature = bezierFeatures[featureName]; const demo = document.createElement("bezier-demo-pane"); demo.setAttribute("name", featureName); demo.setAttribute("demoOptions", JSON.stringify(feature.demoOptions || {})); demo.setAttribute("triggerOnMouseMove", String(feature.triggerOnMouseMove)); demo.setAttribute("chooseComputeType", String(feature.chooseComputeType)); bezierDemos?.append(demo); }); const subpathDemos = document.getElementById("subpath-demos"); (Object.keys(subpathFeatures) as SubpathFeatureName[]).forEach((featureName) => { const feature = subpathFeatures[featureName]; const demo = document.createElement("subpath-demo-pane"); demo.setAttribute("name", featureName); demo.setAttribute("sliderOptions", JSON.stringify(feature.sliderOptions || [])); demo.setAttribute("triggerOnMouseMove", String(feature.triggerOnMouseMove)); demo.setAttribute("chooseComputeType", String(feature.chooseComputeType)); subpathDemos?.append(demo); });