feat: add docs to monorepo (#22)

This commit is contained in:
Jacob
2022-08-04 16:14:34 +02:00
committed by GitHub
parent 4b6cb660ad
commit 129d557004
38 changed files with 13414 additions and 459 deletions

View File

@@ -4,15 +4,15 @@ about: Create a report to help improve Motion Canvas
title: ''
labels: bug
assignees: aarthificial
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior
Steps to reproduce the behavior
or a code snippet containing the scene that causes the problem:
```ts
export default function* problem(scene: Scene) {
// troublesome code
@@ -26,8 +26,9 @@ If applicable, a clear and concise description of what you expected to happen.
If applicable, add a screenshot of the errors displayed in the console of your browser (F12) or your terminal.
**Package versions (please complete the following information):**
- core: [e.g. 1.0.0]
- ui: [e.g. 1.0.0]
- core: [e.g. 1.0.0]
- ui: [e.g. 1.0.0]
**Additional context**
Add any other context about the problem here.

View File

@@ -4,7 +4,6 @@ about: Report an issue or suggest improvements for documentation
title: ''
labels: documentation
assignees: aarthificial
---
**Description**

View File

@@ -4,11 +4,10 @@ about: Suggest an idea for Motion Canvas
title: ''
labels: enhancement
assignees: aarthificial
---
**Description**
A clear and concise description of why the feature is needed.
A clear and concise description of why the feature is needed.
What problem does it aim to fix?
What benefits does it bring?

21
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Deploy Documentation to GitHub Pages
on: workflow_dispatch
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- run: npm ci
- run: npm run docs:build
- uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
publish_dir: ./packages/docs/build
external_repository: motion-canvas/motion-canvas.github.io

10
.prettierignore Normal file
View File

@@ -0,0 +1,10 @@
node_modules
lib
dist
static
.git
.docusaurus
.github
package.json
package-lock.json
CHANGELOG.md

View File

@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
- Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
@@ -119,14 +119,14 @@ version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
[Mozilla's code of conduct enforcement ladder][mozilla coc].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
[mozilla coc]: https://github.com/mozilla/diversity
[faq]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

View File

@@ -146,6 +146,7 @@ The project is maintained as one monorepo containing the following packages:
| `core` | All logic related to running and rendering animations. |
| `ui` | The user interface used for editing. |
| `template` | A template project included for developer's convenience. |
| `docs` | [Our documentation website.][docs] |
After cloning the repo, run `npm install` in the root of the project to install
all necessary dependencies.

View File

@@ -4,10 +4,7 @@
"useWorkspaces": true,
"private": false,
"version": "9.1.1",
"ignoreChanges": [
"**/*.test.ts",
"**/*.md"
],
"ignoreChanges": ["**/*.test.ts", "**/*.md"],
"message": "ci(release): %v [skip ci]",
"conventionalCommits": true,
"createRelease": "github"

13193
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,10 @@
"ui:serve": "npm run serve -w packages/ui",
"template:serve": "npm run serve -w packages/template",
"template:ui": "npm run ui -w packages/template",
"eslint": "eslint --fix \"**/*.ts?(x)\""
"docs:start": "npm run start -w packages/docs",
"docs:build": "npm run build -w packages/docs",
"eslint": "eslint --fix \"**/*.ts?(x)\"",
"prettier": "prettier --write ."
},
"devDependencies": {
"@commitlint/cli": "^17.0.3",
@@ -29,6 +32,6 @@
},
"lint-staged": {
"*.{ts,tsx}": "eslint --fix",
"*.{ts,tsx,md,scss}": "prettier --write"
"*.{js,jsx,ts,tsx,md,scss}": "prettier --write"
}
}

View File

@@ -17,7 +17,15 @@
"jsxImportSource": "@motion-canvas/core/lib",
"paths": {
"@motion-canvas/core/lib/jsx-runtime": ["jsx-runtime.ts"]
}
},
"types": [
"node",
"prismjs",
"three",
"webpack-env",
"dom-webcodecs",
"jest"
]
},
"include": ["src"]
}

21
packages/docs/.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
docs/api
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

View File

@@ -0,0 +1,11 @@
---
slug: hello-world
title: Hello World!
authors: aarthificial
---
import YouTubeVideo from '@site/src/components/YouTubeVideo';
Hello World!
<YouTubeVideo src="https://www.youtube.com/embed/WTUafAwrunE" />

View File

@@ -0,0 +1,5 @@
aarthificial:
name: Jacob
title: Motion Canvas Creator
url: https://twitter.com/aarthificial
image_url: https://github.com/aarthificial.png

View File

@@ -0,0 +1,9 @@
const darkCodeTheme = require('prism-react-renderer/themes/vsDark');
module.exports = {
...darkCodeTheme,
plain: {
color: '#f8f8f8',
backgroundColor: '#242424',
},
};

View File

@@ -0,0 +1,3 @@
const lightCodeTheme = require('prism-react-renderer/themes/github');
module.exports = lightCodeTheme;

View File

@@ -0,0 +1,4 @@
label: Getting Started
position: 2
link:
type: generated-index

View File

@@ -0,0 +1,7 @@
---
sidebar_position: 1
---
# Installation
TODO

View File

@@ -0,0 +1,7 @@
---
sidebar_position: 1
---
# Introduction
TODO

View File

@@ -0,0 +1,160 @@
// @ts-check
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Motion Canvas',
tagline: 'Create animations programmatically',
url: 'https://motion-canvas.github.io',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'motion-canvas',
projectName: 'motion-canvas.github.io',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
colorMode: {
defaultMode: 'dark',
},
navbar: {
title: 'Motion Canvas',
logo: {
alt: 'Motion Canvas Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'docSidebar',
sidebarId: 'guides',
position: 'left',
label: 'Guides',
},
{
type: 'docSidebar',
sidebarId: 'api',
position: 'left',
label: 'API',
},
{to: '/blog', label: 'Blog', position: 'left'},
{
href: 'https://github.com/motion-canvas',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Guides',
to: 'guides/intro',
},
{
label: 'API',
to: 'api',
},
],
},
{
title: 'Community',
items: [
{
label: 'Patreon',
href: 'https://patreon.com/aarthificial',
},
{
label: 'YouTube',
href: 'https://youtube.com/aarthificial',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/motion-canvas',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Motion Canvas. Built with Docusaurus.`,
},
prism: {
theme: require('./config/lightCodeTheme'),
darkTheme: require('./config/darkCodeTheme'),
},
}),
themes: [
[
'@docusaurus/theme-classic',
{
customCss: require.resolve('./src/css/custom.css'),
},
],
],
plugins: [
[
'@docusaurus/plugin-content-docs',
{
routeBasePath: '/',
sidebarPath: 'sidebars.js',
editUrl: ({versionDocsDirPath, docPath}) =>
`https://github.com/motion-canvas/motion-canvas/blob/main/${versionDocsDirPath}/${docPath}`,
},
],
[
'@docusaurus/plugin-content-blog',
{
showReadingTime: true,
editUrl: ({blogDirPath, blogPath}) =>
`https://github.com/motion-canvas/motion-canvas/blob/main/${blogDirPath}/${blogPath}`,
},
],
'@docusaurus/plugin-content-pages',
'@docusaurus/plugin-debug',
'@docusaurus/plugin-sitemap',
[
'docusaurus-plugin-typedoc',
{
excludeExternals: true,
entryPoints: [
'../core/src',
'../core/src/animations',
'../core/src/components',
'../core/src/decorators',
'../core/src/events',
'../core/src/flow',
'../core/src/helpers',
'../core/src/media',
'../core/src/player',
'../core/src/scenes',
'../core/src/styles',
'../core/src/themes',
'../core/src/threading',
'../core/src/transitions',
'../core/src/tweening',
'../core/src/types',
'../core/src/utils',
],
tsconfig: '../core/tsconfig.json',
},
],
],
};
module.exports = config;

View File

@@ -0,0 +1,49 @@
{
"name": "@motion-canvas/docs",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "^2.0.1",
"@docusaurus/preset-classic": "^2.0.1",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.0.0",
"@tsconfig/docusaurus": "^1.0.5",
"docusaurus-plugin-typedoc": "^0.17.5",
"typedoc": "^0.23.7",
"typedoc-plugin-markdown": "^3.13.3",
"typescript": "^4.7.4"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"engines": {
"node": ">=16.14"
}
}

43
packages/docs/sidebars.js Normal file
View File

@@ -0,0 +1,43 @@
// @ts-check
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
guides: [{type: 'autogenerated', dirName: 'guides'}],
api: [
{
type: 'category',
label: 'Modules',
collapsed: false,
link: {
type: 'generated-index',
},
items: [{type: 'autogenerated', dirName: 'api/modules'}],
},
{
type: 'category',
label: 'Classes',
link: {
type: 'generated-index',
},
items: [{type: 'autogenerated', dirName: 'api/classes'}],
},
{
type: 'category',
label: 'Enumerations',
link: {
type: 'generated-index',
},
items: [{type: 'autogenerated', dirName: 'api/enums'}],
},
{
type: 'category',
label: 'Interfaces',
link: {
type: 'generated-index',
},
items: [{type: 'autogenerated', dirName: 'api/interfaces'}],
},
],
};
module.exports = sidebars;

View File

@@ -0,0 +1,74 @@
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>
);
}

View File

@@ -0,0 +1,12 @@
.features {
display: flex;
align-items: center;
padding: 2rem 0;
width: 100%;
}
.featureSvg {
height: 200px;
width: 200px;
margin: 1rem 0;
}

View File

@@ -0,0 +1,26 @@
import React from 'react';
export interface YouTubeVideoProps {
src: string;
width?: number;
height?: number;
title?: string;
}
export default function YouTubeVideo({
src,
width,
height,
title,
}: YouTubeVideoProps): JSX.Element {
return (
<iframe
width={width ?? 560}
height={height ?? 315}
src={src}
title={title ?? 'YouTube video player'}
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
);
}

View File

@@ -0,0 +1,47 @@
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/
/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
--ifm-color-primary-light: #33925d;
--ifm-color-primary-lighter: #359962;
--ifm-color-primary-lightest: #3cad6e;
--ifm-code-font-size: 95%;
--ifm-background-color: #eee;
--ifm-background-surface-color: #fff;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}
/* For readability concerns, you should choose a lighter palette in dark mode. */
html[data-theme='dark'] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--ifm-background-color: #141414;
--ifm-background-surface-color: #242424;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
.footer--dark {
--ifm-footer-background-color: #242424;
}
html {
height: 100%;
}
a.button:hover {
color: var(--ifm-button-color);
text-decoration: none;
}

View File

@@ -0,0 +1,23 @@
/**
* 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;
}

View File

@@ -0,0 +1,45 @@
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>
</>
);
}
export default function Home(): JSX.Element {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />"
>
<HomepageHeader />
<main>
<HomepageFeatures />
</main>
</Layout>
);
}

0
packages/docs/static/.nojekyll vendored Normal file
View File

BIN
packages/docs/static/img/favicon.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,4 @@
<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>

After

Width:  |  Height:  |  Size: 306 B

View File

@@ -0,0 +1,4 @@
<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>

After

Width:  |  Height:  |  Size: 289 B

View File

@@ -0,0 +1,4 @@
<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>

After

Width:  |  Height:  |  Size: 299 B

3
packages/docs/static/img/logo.svg vendored Normal file
View File

@@ -0,0 +1,3 @@
<svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<circle cx="100" cy="100" r="100" fill="#141414"/>
</svg>

After

Width:  |  Height:  |  Size: 149 B

View File

@@ -0,0 +1,7 @@
{
"extends": "@tsconfig/docusaurus/tsconfig.json",
"compilerOptions": {
"baseUrl": "."
},
"include": ["."]
}

View File

@@ -1,6 +1,14 @@
{
"extends": "@motion-canvas/core/tsconfig.project.json",
"compilerOptions": {
"baseUrl": "src"
"baseUrl": "src",
"types": [
"node",
"prismjs",
"three",
"webpack-env",
"dom-webcodecs",
"jest"
]
}
}
}