Visualize Your Ideas With Code
docs: add editor preview (#140)
Jacob453d69efa7bc
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.ymlindex 89323b2e..220de68b 100644--- a/.github/workflows/docs.yml+++ b/.github/workflows/docs.yml@@ -18,6 +18,7 @@ jobs:- run: npm ci- run: npx lerna run build- run: npm run examples:build+ - run: npm run ui:showcase- run: npm run docs:buildenv:NODE_OPTIONS: "--max-old-space-size=8192"diff --git a/package.json b/package.jsonindex 0fa98d8f..0e6c6297 100644--- a/package.json+++ b/package.json@@ -13,6 +13,7 @@"2d:watch": "npm run watch -w packages/2d","ui:build": "npm run build -w packages/ui","ui:dev": "npm run dev -w packages/ui",+ "ui:showcase": "npm run showcase -w packages/ui","template:serve": "npm run serve -w packages/template","template:build": "npm run build -w packages/template","examples:serve": "npm run serve -w packages/examples",diff --git a/packages/docs/.gitignore b/packages/docs/.gitignoreindex 5d4dd87b..18f5e540 100644--- a/packages/docs/.gitignore+++ b/packages/docs/.gitignore@@ -10,6 +10,7 @@docs/core-apidocs/2d-apistatic/examples+static/editor# Misc.DS_Storediff --git a/packages/docs/docusaurus.config.js b/packages/docs/docusaurus.config.jsindex 725596ce..8c387249 100644--- a/packages/docs/docusaurus.config.js+++ b/packages/docs/docusaurus.config.js@@ -3,7 +3,7 @@/** @type {import('@docusaurus/types').Config} */const config = {title: 'Motion Canvas',- tagline: 'Create animations programmatically',+ tagline: 'Visualize complex ideas programmatically',url: 'https://motion-canvas.github.io',baseUrl: '/',onBrokenLinks: 'throw',@@ -38,7 +38,7 @@ const config = {{to: '/api/core', label: 'API', position: 'left'},{to: '/blog', label: 'Blog', position: 'left'},{- href: 'https://github.com/motion-canvas',+ href: 'https://github.com/motion-canvas/motion-canvas',position: 'right',className: 'navbar-github-link','aria-label': 'GitHub repository',@@ -82,7 +82,7 @@ const config = {},{label: 'GitHub',- href: 'https://github.com/motion-canvas',+ href: 'https://github.com/motion-canvas/motion-canvas',},],},@@ -125,7 +125,22 @@ const config = {'@docusaurus/plugin-content-pages','@docusaurus/plugin-debug','@docusaurus/plugin-sitemap',- require('./typedoc'),+ './typedoc',+ [+ './editor',+ {+ examples: [+ {+ name: 'random',+ url: 'Random values generator',+ },+ {+ name: 'quickstart',+ url: 'Quickstart example',+ },+ ],+ },+ ],],};diff --git a/packages/docs/editor.js b/packages/docs/editor.jsnew file mode 100644index 00000000..8dd34bcd--- /dev/null+++ b/packages/docs/editor.js@@ -0,0 +1,35 @@+const fs = require('fs');++module.exports = (context, options) => ({+ name: 'docusaurus-editor-plugin',+ async loadContent() {+ const editorFile = await fs.promises.readFile('../ui/editor.html');+ const html = editorFile+ .toString()+ .replace('{{style}}', '/editor/style.css')+ .replace('{{source}}', './project.js');++ const examples = options.examples ?? [];+ for (const {name} of examples) {+ const dir = `./static/editor/${name}`;+ if (!fs.existsSync(dir)) {+ fs.mkdirSync(dir, {recursive: true});+ }++ await fs.promises.writeFile(`${dir}/index.html`, html);+ await fs.promises.writeFile(+ `${dir}/project.js`,+ `import project from '/examples/${name}.js';` ++ `import {editor} from '/editor/main.js';` ++ `editor(project);`,+ );+ }++ await fs.promises.writeFile(`./static/editor/index.html`, html);+ await fs.promises.writeFile(+ `./static/editor/project.js`,+ `import {index} from '/editor/main.js';` ++ `index(${JSON.stringify(examples)});`,+ );+ },+});diff --git a/packages/docs/src/components/Homepage/Features.tsx b/packages/docs/src/components/Homepage/Features.tsxnew file mode 100644index 00000000..2163403e--- /dev/null+++ b/packages/docs/src/components/Homepage/Features.tsx@@ -0,0 +1,115 @@+import React from 'react';+import clsx from 'clsx';+import styles from './styles.module.css';++import CodeBlock from '@theme/CodeBlock';+import Link from '@docusaurus/Link';+import YouTubeVideo from '@site/src/components/YouTubeVideo';++import UI from '@site/static/img/ui.svg';++const codeSample = `export makeScene(function* (view) {+ const circle = createRef<Circle>();+ view.add(+ <Circle+ ref={circle}+ width={320}+ height={320}+ fill={'blue'}+ />+ );++ yield* circle().scale(2, 0.3);+ yield* waitUntil('event');+ yield* all(+ circle().scale(1, 0.3),+ circle().position.y(200, 0.3),+ );+ yield* circle().fill('green', 0.3);+});`;++type FeatureItem = {+ children: JSX.Element | JSX.Element[];+ content: JSX.Element;+};++function Feature({content, children}: FeatureItem) {+ return (+ <div className={clsx(styles.feature, 'row')}>+ <div className="col col--6 col--offset-1">+ <div className={styles.preview}>{content}</div>+ </div>+ <div className="col col--4 padding-top--lg">{children}</div>+ </div>+ );+}++export default function HomepageFeatures(): JSX.Element {+ return (+ <section className={styles.features}>+ <div className="container">+ <Feature content={<UI />}>+ <h3>+ Best of <b>Both</b> Worlds+ </h3>+ <p>+ Some things are easier with a mouse. Write animations in TypeScript+ with your favorite IDE; Use a web-based editor to sync them with+ audio.+ </p>+ <p>+ Powered by{' '}+ <a href="https://vitejs.dev/" target="_blank">+ Vite+ </a>+ , a real-time preview of your animation automatically updates upon+ any changes.+ </p>+ <p>+ <a+ className="button button--outline button--lg"+ href="/editor/quickstart"+ target="_blank"+ >+ Try the Editor+ </a>+ </p>+ </Feature>+ <Feature content={<CodeBlock language="tsx">{codeSample}</CodeBlock>}>+ <h3>+ <b>Procedural</b> for a Change+ </h3>+ <p>+ Let the execution of your code define the animation. Write generator+ functions that describe what should happen - step by step.+ </p>+ <p>+ Focus on duration, speed and acceleration instead of hardcoded key+ frames.+ </p>+ <p>+ <Link+ className="button button--outline button--lg"+ to="/guides/getting-started/quickstart"+ >+ Learn More+ </Link>+ </p>+ </Feature>+ <Feature+ content={+ <YouTubeVideo src="https://www.youtube.com/embed/HsOKwUwL1bE" />+ }+ >+ <h3>+ <b>Tested</b> in Combat+ </h3>+ <p>+ The road ahead is still long, but you can already use Motion Canvas+ to create production-quality animations.+ </p>+ </Feature>+ </div>+ </section>+ );+}diff --git a/packages/docs/src/components/Homepage/Header.tsx b/packages/docs/src/components/Homepage/Header.tsxnew file mode 100644index 00000000..6b603d63--- /dev/null+++ b/packages/docs/src/components/Homepage/Header.tsx@@ -0,0 +1,40 @@+import React from 'react';+import clsx from 'clsx';+import styles from './styles.module.css';+import Link from '@docusaurus/Link';++export default function HomepageHeader() {+ return (+ <>+ <header className={styles.banner}>+ <h1 className={styles.title}>+ Visualize Complex+ <br />+ Ideas <b>Programmatically</b>+ </h1>+ <h1 className={clsx(styles.title, styles.mobile)}>+ Visualize+ <br />+ Complex Ideas+ <br />+ <b>Programmatically</b>+ </h1>+ <div className={styles.buttons}>+ <Link+ className="button button--primary button--lg"+ to="/guides/intro"+ >+ Get Started+ </Link>+ <a+ className="button button--outline button--lg"+ href="https://github.com/motion-canvas/motion-canvas/blob/main/CONTRIBUTING.md"+ target="_blank"+ >+ Contribute+ </a>+ </div>+ </header>+ </>+ );+}diff --git a/packages/docs/src/components/Homepage/styles.module.css b/packages/docs/src/components/Homepage/styles.module.cssnew file mode 100644index 00000000..e083b596--- /dev/null+++ b/packages/docs/src/components/Homepage/styles.module.css@@ -0,0 +1,113 @@+.title {+ font-family: var(--ifm-font-family-monospace);+ font-size: min(3rem, 5.5vw);+}++.title.mobile {+ font-size: min(3rem, 7.5vw);+ display: none;+}++.banner {+ background: transparent;+ padding: 4rem 0;+ text-align: center;+ position: relative;+ overflow: hidden;+}++.buttons {+ padding-top: var(--ifm-spacing-vertical);+ gap: var(--ifm-spacing-horizontal);+ display: flex;+ align-items: center;+ justify-content: center;+}++.features {+ display: flex;+ align-items: center;+ margin-bottom: 2rem;+ width: 100%;+}++.feature {+ flex-wrap: wrap-reverse;+ padding: 2rem 0;+}++.title b,+.feature b {+ color: var(--ifm-color-primary);+}++.feature.flip {+ flex-direction: row-reverse;+}++.preview {+ background-color: var(--ifm-background-surface-color);+ border-radius: var(--ifm-global-radius);+ border: 1px solid var(--ifm-color-emphasis-100);+ --ifm-leading: 0;+}++.preview iframe {+ display: block;+ width: 100%;+ height: auto;+ aspect-ratio: 16 / 9;+}++.preview svg {+ display: block;+}++.preview svg g {+ animation: slide 4s infinite;+}++@keyframes slide {+ 0% {+ transform: translateX(0px);+ }+ 50% {+ transform: translateX(-100px);+ }+ 100% {+ transform: translateX(0px);+ }+}++@media screen and (max-width: 996px) {+ .feature {+ flex-wrap: wrap-reverse;+ padding: 1rem 0;+ }+}++@media screen and (max-width: 540px) {+ .banner {+ padding: 2rem;+ }++ :global(.button) {+ --ifm-button-size-multiplier: 1;+ }+}++@media screen and (max-width: 400px) {+ .title {+ display: none;+ }++ .title.mobile {+ font-size: min(3rem, 7.5vw);+ display: block;+ }++ .buttons {+ flex-direction: column;+ align-items: stretch;+ }+}diff --git a/packages/docs/src/components/HomepageFeatures/index.tsx b/packages/docs/src/components/HomepageFeatures/index.tsxdeleted file mode 100644index 051571ab..00000000--- a/packages/docs/src/components/HomepageFeatures/index.tsx+++ /dev/null@@ -1,74 +0,0 @@-import React from 'react';-import clsx from 'clsx';-import styles from './styles.module.css';--import featureOne from '@site/static/img/feature_one.svg';-import featureTwo from '@site/static/img/feature_three.svg';-import featureThree from '@site/static/img/feature_two.svg';--type FeatureItem = {- title: string;- Svg: React.ComponentType<React.ComponentProps<'svg'>>;- description: JSX.Element;-};--const FeatureList: FeatureItem[] = [- {- title: 'Feature One',- Svg: featureOne,- description: (- <>- Adipisci maxime non quod temporibus! Deserunt doloremque esse harum id- illo incidunt laborum.- </>- ),- },- {- title: 'Feature Two',- Svg: featureTwo,- description: (- <>- Enim impedit labore maxime? Aliquid assumenda cum explicabo illum ipsa,- ipsam, laudantium libero minima molestiae.- </>- ),- },- {- title: 'Feature Three',- Svg: featureThree,- description: (- <>- A cumque delectus dolorum earum, et eum excepturi harum iusto labore,- laudantium minus mollitia natus nisi numquam obcaecati.- </>- ),- },-];--function Feature({title, Svg, description}: FeatureItem) {- return (- <div className={clsx('col col--4')}>- <div className="text--center">- <Svg className={styles.featureSvg} role="img" />- </div>- <div className="text--center padding-horiz--md">- <h3>{title}</h3>- <p>{description}</p>- </div>- </div>- );-}--export default function HomepageFeatures(): JSX.Element {- return (- <section className={styles.features}>- <div className="container">- <div className="row">- {FeatureList.map((props, idx) => (- <Feature key={idx} {...props} />- ))}- </div>- </div>- </section>- );-}diff --git a/packages/docs/src/components/HomepageFeatures/styles.module.css b/packages/docs/src/components/HomepageFeatures/styles.module.cssdeleted file mode 100644index b741a7b2..00000000--- a/packages/docs/src/components/HomepageFeatures/styles.module.css+++ /dev/null@@ -1,12 +0,0 @@-.features {- display: flex;- align-items: center;- padding: 2rem 0;- width: 100%;-}--.featureSvg {- height: 200px;- width: 200px;- margin: 1rem 0;-}diff --git a/packages/docs/src/components/YouTubeVideo.tsx b/packages/docs/src/components/YouTubeVideo.tsxindex f7c8bf7e..89f1217d 100644--- a/packages/docs/src/components/YouTubeVideo.tsx+++ b/packages/docs/src/components/YouTubeVideo.tsx@@ -18,6 +18,7 @@ export default function YouTubeVideo({width={width ?? 560}height={height ?? 315}src={src}+ loading="lazy"title={title ?? 'YouTube video player'}allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"allowFullScreendiff --git a/packages/docs/src/css/custom.css b/packages/docs/src/css/custom.cssindex e2b83076..a754d894 100644--- a/packages/docs/src/css/custom.css+++ b/packages/docs/src/css/custom.css@@ -144,6 +144,10 @@ html[data-theme='dark'] .navbar-github-link::before {background-image: url('/img/github-icon-dark.svg');}+.navbar-sidebar .navbar-github-link {+ display: none;+}+@media screen and (max-width: 996px) {:root {--ifm-navbar-background-color: rgb(255, 255, 255);@@ -157,3 +161,14 @@ html[data-theme='dark'] .navbar-github-link::before {backdrop-filter: none;}}++.button.button--outline {+ background-color: transparent;+ color: var(--ifm-link-color);+ border: 1px solid var(--ifm-color-emphasis-300);+}++.button.button--outline:hover {+ color: var(--ifm-link-color);+ border-color: var(--ifm-color-primary);+}diff --git a/packages/docs/src/pages/index.module.css b/packages/docs/src/pages/index.module.cssdeleted file mode 100644index 9f71a5da..00000000--- a/packages/docs/src/pages/index.module.css+++ /dev/null@@ -1,23 +0,0 @@-/**- * CSS files with the .module.css suffix will be treated as CSS modules- * and scoped locally.- */--.heroBanner {- padding: 4rem 0;- text-align: center;- position: relative;- overflow: hidden;-}--@media screen and (max-width: 996px) {- .heroBanner {- padding: 2rem;- }-}--.buttons {- display: flex;- align-items: center;- justify-content: center;-}diff --git a/packages/docs/src/pages/index.tsx b/packages/docs/src/pages/index.tsxindex bfdae31d..da6a07b0 100644--- a/packages/docs/src/pages/index.tsx+++ b/packages/docs/src/pages/index.tsx@@ -1,33 +1,8 @@import React from 'react';-import clsx from 'clsx';-import Link from '@docusaurus/Link';import useDocusaurusContext from '@docusaurus/useDocusaurusContext';import Layout from '@theme/Layout';-import HomepageFeatures from '@site/src/components/HomepageFeatures';--import styles from './index.module.css';--function HomepageHeader() {- const {siteConfig} = useDocusaurusContext();- return (- <>- <header className={clsx('hero hero--secondary', styles.heroBanner)}>- <div className="container">- <h1 className="hero__title">{siteConfig.title}</h1>- <p className="hero__subtitle">{siteConfig.tagline}</p>- <div className={styles.buttons}>- <Link- className="button button--primary button--lg"- to="/guides/intro"- >- Get Started- </Link>- </div>- </div>- </header>- </>- );-}+import HomepageHeader from '@site/src/components/Homepage/Header';+import HomepageFeatures from '@site/src/components/Homepage/Features';export default function Home(): JSX.Element {const {siteConfig} = useDocusaurusContext();diff --git a/packages/docs/static/img/feature_one.svg b/packages/docs/static/img/feature_one.svgdeleted file mode 100644index 1d0c3a0d..00000000--- a/packages/docs/static/img/feature_one.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">- <circle cx="100" cy="100" r="100" style="fill: var(--ifm-background-surface-color)"/>- <rect width="90" height="90" x="55" y="55" style="stroke: var(--ifm-color-primary)" fill="none" stroke-width="8" rx="8"/>-</svg>\ No newline at end of filediff --git a/packages/docs/static/img/feature_three.svg b/packages/docs/static/img/feature_three.svgdeleted file mode 100644index 56140748..00000000--- a/packages/docs/static/img/feature_three.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">- <circle cx="100" cy="100" r="100" style="fill: var(--ifm-background-surface-color)"/>- <circle cx="100" cy="100" r="50" style="stroke: var(--ifm-color-primary)" fill="none" stroke-width="8"/>-</svg>\ No newline at end of filediff --git a/packages/docs/static/img/feature_two.svg b/packages/docs/static/img/feature_two.svgdeleted file mode 100644index 1fb55b06..00000000--- a/packages/docs/static/img/feature_two.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">- <circle cx="100" cy="100" r="100" style="fill: var(--ifm-background-surface-color)"/>- <polygon points="50,65 150,65 100.0,151.6" style="stroke: var(--ifm-color-primary)" fill="none" stroke-width="8"/>-</svg>\ No newline at end of filediff --git a/packages/docs/static/img/ui.svg b/packages/docs/static/img/ui.svgnew file mode 100644index 00000000..54d71502--- /dev/null+++ b/packages/docs/static/img/ui.svg@@ -0,0 +1,120 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">+<svg width="100%" height="100%" viewBox="0 0 640 360" version="1.1" xmlns="http://www.w3.org/2000/svg"+ xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/"+ style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.5;"><rect id="Artboard1" x="0" y="0" width="640" height="360" style="fill:none;"/>++ <rect id="background" x="-0" y="0" width="640" height="360" style="fill:#181818;"/>+ <defs>+ <style>+ #event {}+ </style>+ </defs>+ <rect id="active_background" x="79" y="78" width="561" height="282" style="fill:#242424;"/>+ <g id="controls"><rect x="307" y="12" width="24" height="24" style="fill:none;fill-rule:nonzero;"/>+ <path d="M315,17l0,14l11,-7l-11,-7Z" style="fill:#959595;fill-rule:nonzero;"/>+ <rect x="343" y="12" width="24" height="24" style="fill:none;fill-rule:nonzero;"/>+ <path d="M349,30l8.5,-6l-8.5,-6l0,12Zm10,-12l0,12l2,0l0,-12l-2,0Z" style="fill:#959595;fill-rule:nonzero;"/>+ <rect x="271" y="12" width="24" height="24" style="fill:none;fill-rule:nonzero;"/>+ <path d="M277,18l2,0l0,12l-2,0l0,-12Zm3.5,6l8.5,6l0,-12l-8.5,6Z" style="fill:#959595;fill-rule:nonzero;"/>+ <rect x="379" y="12" width="24" height="24" style="fill:none;fill-rule:nonzero;"/>+ <path d="M386,19l10,0l0,3l4,-4l-4,-4l0,3l-12,0l0,6l2,0l0,-4Zm10,10l-10,0l0,-3l-4,4l4,4l0,-3l12,0l0,-6l-2,0l0,4Z"+ style="fill:#959595;fill-rule:nonzero;"/>+ <rect x="235" y="12" width="24" height="24" style="fill:none;fill-rule:nonzero;"/>+ <path d="M238,21l0,6l4,0l5,5l0,-16l-5,5l-4,0Zm13.5,3c0,-1.77 -1.02,-3.29 -2.5,-4.03l0,8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02Zm-2.5,-8.77l0,2.06c2.89,0.86 5,3.54 5,6.71c0,3.17 -2.11,5.85 -5,6.71l0,2.06c4.01,-0.91 7,-4.49 7,-8.77c0,-4.28 -2.99,-7.86 -7,-8.77Z"+ style="fill:#959595;fill-rule:nonzero;"/></g>+ <g id="lines"><path d="M271,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M463,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M295,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M487,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M199,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M415,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M607,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M175,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M439,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M631,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M223,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M367,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M559,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M127,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M391,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M583,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M151,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M319,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M511,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M79,78l0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M31,78l-0,282" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M640,48l-640,0" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/>+ <path d="M343,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M535,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M103,78l0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M55,78l-0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M7,78l-0,282" style="fill:none;stroke:#202020;stroke-width:2px;"/>+ <path d="M640,78l-640,0" style="fill:none;stroke:#1d1d1d;stroke-width:2px;"/></g>+ <path id="event_background"+ d="M308.534,144c0,-6.627 -5.372,-12 -12,-12l-121.068,0c-6.628,0 -12,5.373 -12,12l-0,0c-0,6.627 5.372,12 12,12l121.068,0c6.628,-0 12,-5.373 12,-12l0,-0Z"+ style="fill:#274358;"/>+ <g id="scene"><path d="M637,88c0,-1.061 -0.421,-2.078 -1.172,-2.828c-0.75,-0.751 -1.767,-1.172 -2.828,-1.172c-47.186,0 -496.814,0 -544,0c-1.061,-0 -2.078,0.421 -2.828,1.172c-0.751,0.75 -1.172,1.767 -1.172,2.828c0,8.02 0,25.98 0,34c-0,1.061 0.421,2.078 1.172,2.828c0.75,0.751 1.767,1.172 2.828,1.172c47.186,0 496.814,0 544,0c1.061,0 2.078,-0.421 2.828,-1.172c0.751,-0.75 1.172,-1.767 1.172,-2.828c0,-8.02 0,-25.98 0,-34Z" style="fill:#444;"/>+ <g id="scene1" serif:id="scene" transform="matrix(14,0,0,14,145,109.11)"></g>+ <text x="103px" y="109.11px"+ style="font-family:'JetBrainsMono-Regular', 'JetBrains Mono', monospace;font-size:14px;fill:#fff;fill-opacity:0.6;">scene</text></g>+ <g id="range"><path d="M640,48l-557,0c-2.208,0 -4,1.792 -4,4l-0,22c-0,2.208 1.792,4 4,4l557,0l0,-30Z" style="fill:#1e3a4f;"/>+ <path d="M79,73.9l0,0.002c0,2.263 1.835,4.098 4.098,4.098c50.804,0 556.902,0 556.902,0"+ style="fill:none;stroke:#32a1f6;stroke-width:2px;"/></g>+ <g id="event"><path d="M407,144c-0,-6.627 -5.373,-12 -12,-12c-26.121,0 -87.879,0 -114,0c-6.627,0 -12,5.373 -12,12c0,0 0,0 0,0c0,6.627 5.373,12 12,12c26.121,0 87.879,0 114,0c6.627,-0 12,-5.373 12,-12c0,0 0,0 0,-0Z" style="fill:#274358;"/>+ <path d="M431,144c-0,-6.627 -5.373,-12 -12,-12l-48,0l0,12c0,3.183 1.264,6.235 3.515,8.485c2.25,2.251 5.302,3.515 8.485,3.515l36,0c6.627,0 12,-5.373 12,-12l0,-0Z"+ style="fill:#33a6ff;"/>+ <path d="M431,144c-0,6.627 -5.373,12 -12,12l-36,0c-3.183,0 -6.235,-1.264 -8.485,-3.515c-2.251,-2.25 -3.515,-5.302 -3.515,-8.485l0,-12l48,-0c6.627,-0 12,5.373 12,12Zm-2,-0c-0,-5.523 -4.477,-10 -10,-10l-46,0l0,10c0,2.652 1.054,5.196 2.929,7.071c1.875,1.875 4.419,2.929 7.071,2.929l36,0c5.523,0 10,-4.477 10,-10Z"+ style="fill:#fff;"/>+ <g transform="matrix(14,0,0,14,422,148.11)"></g>+ <text x="380px" y="148.11px"+ style="font-family:'JetBrainsMono-Regular', 'JetBrains Mono', monospace;font-size:14px;fill-opacity:0.87;">event</text>+ <g><rect x="423" y="152" width="24" height="24" style="fill:none;"/></g>+ <g><g><g><path d="M446,157.5l0,14.5c0,2.2 -1.8,4 -4,4l-7.3,0c-1.08,0 -2.1,-0.43 -2.85,-1.19l-7.85,-7.98c0,0 1.26,-1.23 1.3,-1.25c0.22,-0.19 0.49,-0.29 0.79,-0.29c0.22,0 0.42,0.06 0.6,0.16c0.04,0.01 4.31,2.46 4.31,2.46l0,-11.91c0,-0.83 0.67,-1.5 1.5,-1.5c0.83,0 1.5,0.67 1.5,1.5l0,7l1,0l0,-9.5c0,-0.83 0.67,-1.5 1.5,-1.5c0.83,0 1.5,0.67 1.5,1.5l0,9.5l1,0l0,-8.5c0,-0.83 0.67,-1.5 1.5,-1.5c0.83,0 1.5,0.67 1.5,1.5l0,8.5l1,0l0,-5.5c0,-0.83 0.67,-1.5 1.5,-1.5c0.83,0 1.5,0.67 1.5,1.5Z" style="fill:#fff;fill-rule:nonzero;"/></g></g></g></g>+ <path id="voice"+ d="M79,210l126,0l2,-4l2,14l2,-22l2,26l2,-30l2,34l2,-44l2,40l2,-40l2,54l2,-62l2,54l2,-38l2,38l2,-42l2,38l2,-30l2,26l2,-20l2,14l2,-12l2,10l2,-12l2,18l2,-16l2,10l2,-6l2,2l16,0l2,-4l2,8l2,-10l2,18l2,-30l2,36l2,-40l2,42l2,-50l2,54l2,-52l2,58l2,-54l2,50l2,-44l2,40l2,-42l2,38.091l2,-44.091l2,46l2,-50l2,52l2,-50l2,52l2,-46l2,42l2,-32l2,28l2,-26l2,20l2,-16l2,20l2,-24l2,30l2,-36l2,40l2,-48l2,50l2,-44l2,36l2,-30l2.415,24l1.585,-18l2,14l2,-20l2,26l2,-22l2,16l2,-10l2,2l262,0"+ style="fill:none;stroke:#444;stroke-width:2px;stroke-linecap:square;"/>+ <g id="numbers"><g transform="matrix(12,0,0,12,230.2,67.38)"></g>+ <text x="215.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">30</text>+ <g transform="matrix(12,0,0,12,182.2,67.38)"></g>+ <text x="167.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">30</text>+ <g transform="matrix(12,0,0,12,134.2,67.38)"></g>+ <text x="119.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">10</text>+ <g transform="matrix(12,0,0,12,82.6,67.38)"></g>+ <text x="75.4px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">0</text>+ <g transform="matrix(12,0,0,12,278.2,67.38)"></g>+ <text x="263.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">40</text>+ <g transform="matrix(12,0,0,12,326.2,67.38)"></g>+ <text x="311.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">50</text>+ <g transform="matrix(12,0,0,12,470.2,67.38)"></g>+ <text x="455.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">80</text>+ <g transform="matrix(12,0,0,12,422.2,67.38)"></g>+ <text x="407.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">70</text>+ <g transform="matrix(12,0,0,12,569.8,67.38)"></g>+ <text x="548.2px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">100</text>+ <g transform="matrix(12,0,0,12,374.2,67.38)"></g>+ <text x="359.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">60</text>+ <g transform="matrix(12,0,0,12,518.2,67.38)"></g>+ <text x="503.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">90</text>+ <g transform="matrix(12,0,0,12,617.8,67.38)"></g>+ <text x="596.2px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">110</text>+ <g transform="matrix(12,0,0,12,41.8,67.38)"></g>+ <text x="20.2px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#959595;">-10</text></g>+ <g id="playhead"><path d="M259,58c0,-1.061 -0.421,-2.078 -1.172,-2.828c-0.75,-0.751 -1.767,-1.172 -2.828,-1.172c-4.439,0 -11.561,0 -16,0c-1.061,-0 -2.078,0.421 -2.828,1.172c-0.751,0.75 -1.172,1.767 -1.172,2.828c0,2.977 0,7.023 0,10c-0,1.061 0.421,2.078 1.172,2.828c0.75,0.751 1.767,1.172 2.828,1.172c4.439,0 11.561,0 16,0c1.061,0 2.078,-0.421 2.828,-1.172c0.751,-0.75 1.172,-1.767 1.172,-2.828c-0,-2.977 -0,-7.023 -0,-10Z" style="fill:#32a1f6;"/>+ <g transform="matrix(12,0,0,12,254.2,67.38)"></g>+ <text x="239.8px" y="67.38px"+ style="font-family:'JetBrainsMono-Bold', 'JetBrains Mono', monospace;font-weight:700;font-size:12px;fill:#fff;">35</text>+ <path d="M247,72l0,288" style="fill:none;stroke:#32a1f6;stroke-width:2px;"/></g></svg>\ No newline at end of filediff --git a/packages/ui/package.json b/packages/ui/package.jsonindex 1b7f2386..b8f77065 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -10,6 +10,7 @@"scripts": {"dev": "vite","build": "tsc && vite build",+ "showcase": "tsc && vite build -c vite.showcase.ts","preview": "vite preview"},"publishConfig": {diff --git a/packages/ui/src/Index.tsx b/packages/ui/src/Index.tsxindex 09999b0a..51a586aa 100644--- a/packages/ui/src/Index.tsx+++ b/packages/ui/src/Index.tsx@@ -15,7 +15,7 @@ export function Index({projects}: IndexProps) {<div className={styles.header}>Projects</div><div className={styles.list}>{projects.map(project => (- <a className={styles.element} href={`/${project.name}`}>+ <a className={styles.element} href={`./${project.name}`}><div className={styles.title}>{project.name}</div><div className={styles.subtitle}>{project.url}</div></a>diff --git a/packages/ui/src/components/sidebar/Sidebar.tsx b/packages/ui/src/components/sidebar/Sidebar.tsxindex 7617b9b6..6f5d4f23 100644--- a/packages/ui/src/components/sidebar/Sidebar.tsx+++ b/packages/ui/src/components/sidebar/Sidebar.tsx@@ -50,7 +50,7 @@ export function Sidebar({setOpen}: SidebarProps) {id: 'project-selection-link',type: TabType.Link,icon: <MotionCanvas />,- url: window.location.pathname === '/' ? undefined : '/',+ url: window.location.pathname === '/' ? undefined : '../',}}{{type: TabType.Space,diff --git a/packages/ui/vite.config.ts b/packages/ui/vite.config.tsindex 04d56ef2..f60560cc 100644--- a/packages/ui/vite.config.ts+++ b/packages/ui/vite.config.ts@@ -10,7 +10,7 @@ export default defineConfig({fileName: 'main',},rollupOptions: {- external: ['@motion-canvas/core'],+ external: [/^@motion-canvas\/core/],},},plugins: [diff --git a/packages/ui/vite.showcase.ts b/packages/ui/vite.showcase.tsnew file mode 100644index 00000000..10c27cf5--- /dev/null+++ b/packages/ui/vite.showcase.ts@@ -0,0 +1,14 @@+import {defineConfig} from 'vite';+import preact from '@preact/preset-vite';++export default defineConfig({+ build: {+ lib: {+ entry: 'src/main.tsx',+ formats: ['es'],+ fileName: 'main',+ },+ outDir: '../docs/static/editor',+ },+ plugins: [preact()],+});