Skip to content

Visualize Your Ideas With Code

docs: add 2.6.0 release (#413)

Jacob059483fc8ef6
diff --git a/package-lock.json b/package-lock.json
index b64a9a21..1f41076c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20686,14 +20686,6 @@
}
}
},
- "node_modules/vite-plugin-wasm": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/vite-plugin-wasm/-/vite-plugin-wasm-3.2.1.tgz",
- "integrity": "sha512-38TPuRUHC+s62JFhZxWtNStujhsav/qFEspDa/+huGCUvn0SbXdXexnxQ+UgIs2pmBnd/xd70fm1R9jW/0qALA==",
- "dependencies": {
- "vite": "^3"
- }
- },
"node_modules/vitest": {
"version": "0.25.5",
"license": "MIT",
@@ -21547,10 +21539,10 @@
},
"packages/2d": {
"name": "@motion-canvas/2d",
- "version": "2.5.0",
+ "version": "2.6.0",
"license": "MIT",
"dependencies": {
- "@motion-canvas/core": "^2.5.0",
+ "@motion-canvas/core": "^2.6.0",
"code-fns": "^0.9.0",
"mathjax-full": "^3.2.2"
},
@@ -21560,7 +21552,7 @@
},
"packages/core": {
"name": "@motion-canvas/core",
- "version": "2.5.0",
+ "version": "2.6.0",
"license": "MIT",
"dependencies": {
"@types/chroma-js": "^2.1.4",
@@ -21577,7 +21569,7 @@
},
"packages/create": {
"name": "@motion-canvas/create",
- "version": "2.5.0",
+ "version": "2.6.0",
"license": "MIT",
"dependencies": {
"prompts": "^2.4.2"
@@ -21586,10 +21578,10 @@
"create-motion-canvas": "index.js"
},
"devDependencies": {
- "@motion-canvas/2d": "^2.5.0",
- "@motion-canvas/core": "^2.5.0",
- "@motion-canvas/ui": "^2.5.0",
- "@motion-canvas/vite-plugin": "^2.4.0"
+ "@motion-canvas/2d": "^2.6.0",
+ "@motion-canvas/core": "^2.6.0",
+ "@motion-canvas/ui": "^2.6.0",
+ "@motion-canvas/vite-plugin": "^2.6.0"
}
},
"packages/docs": {
@@ -21658,10 +21650,10 @@
},
"packages/player": {
"name": "@motion-canvas/player",
- "version": "2.5.0",
+ "version": "2.6.0",
"license": "MIT",
"devDependencies": {
- "@motion-canvas/core": "^2.5.0",
+ "@motion-canvas/core": "^2.6.0",
"sass": "^1.58.0",
"terser": "^5.16.1"
}
@@ -21672,8 +21664,7 @@
"license": "MIT",
"dependencies": {
"@motion-canvas/2d": "*",
- "@motion-canvas/core": "*",
- "vite-plugin-wasm": "^3.2.1"
+ "@motion-canvas/core": "*"
},
"devDependencies": {
"@motion-canvas/ui": "*",
@@ -21682,10 +21673,10 @@
},
"packages/ui": {
"name": "@motion-canvas/ui",
- "version": "2.5.0",
+ "version": "2.6.0",
"license": "MIT",
"dependencies": {
- "@motion-canvas/core": "^2.5.0"
+ "@motion-canvas/core": "^2.6.0"
},
"devDependencies": {
"@preact/preset-vite": "^2.3.0",
@@ -21698,7 +21689,7 @@
},
"packages/vite-plugin": {
"name": "@motion-canvas/vite-plugin",
- "version": "2.4.0",
+ "version": "2.6.0",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.2",
@@ -24936,7 +24927,7 @@
"@motion-canvas/2d": {
"version": "file:packages/2d",
"requires": {
- "@motion-canvas/core": "^2.5.0",
+ "@motion-canvas/core": "^2.6.0",
"@motion-canvas/internal": "0.0.0",
"code-fns": "^0.9.0",
"mathjax-full": "^3.2.2"
@@ -24955,10 +24946,10 @@
"@motion-canvas/create": {
"version": "file:packages/create",
"requires": {
- "@motion-canvas/2d": "^2.5.0",
- "@motion-canvas/core": "^2.5.0",
- "@motion-canvas/ui": "^2.5.0",
- "@motion-canvas/vite-plugin": "^2.4.0",
+ "@motion-canvas/2d": "^2.6.0",
+ "@motion-canvas/core": "^2.6.0",
+ "@motion-canvas/ui": "^2.6.0",
+ "@motion-canvas/vite-plugin": "^2.6.0",
"prompts": "^2.4.2"
}
},
@@ -25016,7 +25007,7 @@
"@motion-canvas/player": {
"version": "file:packages/player",
"requires": {
- "@motion-canvas/core": "^2.5.0",
+ "@motion-canvas/core": "^2.6.0",
"sass": "^1.58.0",
"terser": "^5.16.1"
}
@@ -25027,14 +25018,13 @@
"@motion-canvas/2d": "*",
"@motion-canvas/core": "*",
"@motion-canvas/ui": "*",
- "@motion-canvas/vite-plugin": "*",
- "vite-plugin-wasm": "^3.2.1"
+ "@motion-canvas/vite-plugin": "*"
}
},
"@motion-canvas/ui": {
"version": "file:packages/ui",
"requires": {
- "@motion-canvas/core": "^2.5.0",
+ "@motion-canvas/core": "^2.6.0",
"@preact/preset-vite": "^2.3.0",
"clsx": "^1.2.1",
"highlight.js": "^11.7.0",
@@ -25049,7 +25039,7 @@
"@motion-canvas/internal": "0.0.0",
"@types/follow-redirects": "^1.14.1",
"@types/mime-types": "^2.1.1",
- "@types/node": "*",
+ "@types/node": "^18.14.0",
"follow-redirects": "^1.15.2",
"mime-types": "^2.1.35"
}
@@ -35131,14 +35121,6 @@
"rollup": "^2.79.1"
}
},
- "vite-plugin-wasm": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/vite-plugin-wasm/-/vite-plugin-wasm-3.2.1.tgz",
- "integrity": "sha512-38TPuRUHC+s62JFhZxWtNStujhsav/qFEspDa/+huGCUvn0SbXdXexnxQ+UgIs2pmBnd/xd70fm1R9jW/0qALA==",
- "requires": {
- "vite": "^3"
- }
- },
"vitest": {
"version": "0.25.5",
"requires": {
diff --git a/packages/docs/blog/2023-02-20-version-2.5.0.mdx b/packages/docs/blog/2023-02-20-version-2.5.0.mdx
index 38453637..bcbaf1b9 100644
--- a/packages/docs/blog/2023-02-20-version-2.5.0.mdx
+++ b/packages/docs/blog/2023-02-20-version-2.5.0.mdx
@@ -41,6 +41,7 @@ import Link from '@docusaurus/Link';
background color of a scene using the <code>fill</code> property.
</Issue>
</IssueGroup>
+<hr />
<IssueGroup type={'fix'}>
<Issue user={'aarthificial'} pr={387}>
Support <code>Color</code> to <code>null</code> tweening.
diff --git a/packages/docs/blog/2023-02-24-version-2.6.0.mdx b/packages/docs/blog/2023-02-24-version-2.6.0.mdx
new file mode 100644
index 00000000..cbd99b45
--- /dev/null
+++ b/packages/docs/blog/2023-02-24-version-2.6.0.mdx
@@ -0,0 +1,80 @@
+---
+slug: version-2.6.0
+title: Motion Canvas v2.6.0
+authors: aarthificial
+---
+
+import IssueGroup from '@site/src/components/Release/IssueGroup';
+import Issue from '@site/src/components/Release/Issue';
+import Link from '@docusaurus/Link';
+import CodeBlock from '@theme/CodeBlock';
+
+<IssueGroup type={'feat'}>
+ <Issue user={'ksassnowski'} pr={406}>
+ You can now{' '}
+ <Link to="/docs/tweening#saving-and-restoring-states">
+ store the state of a node
+ </Link>{' '}
+ and restore it at a later point.
+ </Issue>
+ <Issue user={'Ross-Esmond'} pr={401}>
+ <Link to="/docs/code-block">
+ <code>CodeBlock</code>
+ </Link>{' '}
+ is now exported together with other nodes:
+ <CodeBlock language={'ts'} className="margin-top--sm margin-bottom--sm">
+ {`import {CodeBlock} from '@motion-canvas/2d/lib/components';`}
+ </CodeBlock>
+ An improved theme system with the new{' '}
+ <Link to="/api/2d/components/CodeBlock#stockTheme">
+ <code>stockTheme</code>
+ </Link>{' '}
+ property lets you use VS Code themes (powered by{' '}
+ <Link to="https://shiki.matsu.io/">Shiki</Link>)
+ </Issue>
+ <Issue user={'aarthificial'} pr={405}>
+ New{' '}
+ <Link to="/api/2d/components/Layout#alignContent">
+ <code>alignContent</code>
+ </Link>{' '}
+ and{' '}
+ <Link to="/api/2d/components/Layout#alignItems">
+ <code>alignItems</code>
+ </Link>
+ Flexbox properties.
+ </Issue>
+ <Issue user={'ksassnowski'} pr={398}>
+ New{' '}
+ <Link to="/api/2d/components/Node#zIndex">
+ <code>zIndex</code>
+ </Link>{' '}
+ property allows you to change the rendering order of child nodes, without
+ rearranging the hierarchy.
+ </Issue>
+ <Issue user={'WaldemarLehner'} pr={306}>
+ New{' '}
+ <Link to="/api/2d/components/Icon">
+ <code>Icon</code>
+ </Link>{' '}
+ node:
+ <CodeBlock language={'tsx'} className="margin-top--sm margin-bottom--sm">
+ {`<Icon icon={"mdi:typewriter"} size={200} color="white" />`}
+ </CodeBlock>
+ Check out <Link to="https://icones.js.org/collection/all">Icônes</Link> for
+ the list of all possible icons.
+ </Issue>
+ <Issue user={'WaldemarLehner'} pr={357}>
+ Images can now be loaded from the internet. For images with incompatible
+ CORS headers, a new <Link to="/docs/configuration#proxy">CORS Proxy</Link>{' '}
+ can be enabled.
+ </Issue>
+ <Issue user={'aarthificial'} pr={410}>
+ New look for the release blog.
+ </Issue>
+</IssueGroup>
+<hr />
+<IssueGroup type={'fix'}>
+ <Issue user={'aarthificial'} pr={407}>
+ Handle division by zero in lines
+ </Issue>
+</IssueGroup>
diff --git a/packages/docs/docs/components/code-block.mdx b/packages/docs/docs/components/code-block.mdx
index 54607ce6..c39a5506 100644
--- a/packages/docs/docs/components/code-block.mdx
+++ b/packages/docs/docs/components/code-block.mdx
@@ -22,7 +22,7 @@ important snippets.
To display code, set the `code` and `language` property.
```ts
-import {CodeBlock} from '@motion-canvas/2d/lib/components/CodeBlock';
+import {CodeBlock} from '@motion-canvas/2d/lib/components';
yield view.add(
<CodeBlock language="c#" code={`Console.WriteLine("Hello World!")`} />,
@@ -48,7 +48,7 @@ For convenience, the indentation of code will be automatically adjust whenever
the code starts with a new line.
```tsx
-import {CodeBlock} from '@motion-canvas/2d/lib/components/CodeBlock';
+import {CodeBlock} from '@motion-canvas/2d/lib/components';
yield view.add(
// note that the ` bracket is followed by a new line
@@ -71,7 +71,7 @@ console.log('Hello World!');
The indentation is then set by the least indented code.
```tsx
-import {CodeBlock} from '@motion-canvas/2d/lib/components/CodeBlock';
+import {CodeBlock} from '@motion-canvas/2d/lib/components';
yield view.add(
// note that the ` bracket is followed by a new line
@@ -131,7 +131,7 @@ line, starting at the fifth character, and selecting a total of six characters.
Finally, you can use the `lines` function to select whole lines of code.
```tsx
-import {CodeBlock, lines} from '@motion-canvas/2d/lib/components/CodeBlock';
+import {CodeBlock, lines} from '@motion-canvas/2d/lib/components';
const codeRef = createRef();
yield view.add(
@@ -165,7 +165,7 @@ for future edits. Then call `edit` with an embedded `insert` call to add the new
code.
```tsx
-import {CodeBlock, insert} from '@motion-canvas/2d/lib/components/CodeBlock';
+import {CodeBlock, insert} from '@motion-canvas/2d/lib/components';
import {createRef} from '@motion-canvas/core/lib/utils';
const codeRef = createRef<CodeBlock>();
@@ -186,7 +186,7 @@ Removing code is similar, only with the provided code being removed during the
animation.
```tsx
-import {CodeBlock, remove} from '@motion-canvas/2d/lib/components/CodeBlock';
+import {CodeBlock, remove} from '@motion-canvas/2d/lib/components';
yield view.add(<CodeBlock ref={codeRef} code={`var myBool = true;`} />);
diff --git a/packages/docs/docs/getting-started/configuration.mdx b/packages/docs/docs/getting-started/configuration.mdx
index cb632740..accbcd5c 100644
--- a/packages/docs/docs/getting-started/configuration.mdx
+++ b/packages/docs/docs/getting-started/configuration.mdx
@@ -99,3 +99,22 @@ lead to a directory containing the following files:
user interface.
- `index` - Receives a list of all projects as its first argument and creates
the initial page for selecting a project.
+
+### `proxy`
+
+- Type: `boolean | MotionCanvasCorsProxyOptions`
+- Default: `false`
+
+The configuration of the Proxy used for remote sources.
+
+This passes configuration to Motion Canvas' proxy. The proxy is disabled by
+default. You can either pass `true` or a config object to enable it.
+
+- `allowedMimeTypes?: string[]` - Set which types of resources are allowed by
+ default. Catchall on the right side is supported. Pass an empty Array to allow
+ all types of resources, although this is not recommended. Defaults to
+ `["image/*", "video/*"]`.
+- `allowListHosts?: string[]` - Set which hosts are allowed Note that the host
+ is everything to the left of the first `/`, and to the right of the protocol
+ `https://`. AllowList is not used by default, although you should consider
+ setting up just the relevant hosts.
diff --git a/packages/docs/docusaurus.config.js b/packages/docs/docusaurus.config.js
index 45235a18..d6365e9a 100644
--- a/packages/docs/docusaurus.config.js
+++ b/packages/docs/docusaurus.config.js
@@ -6,7 +6,7 @@ const config = {
tagline: 'Visualize complex ideas programmatically',
url: 'https://motioncanvas.io',
baseUrl: '/',
- onBrokenLinks: 'throw',
+ onBrokenLinks: 'log',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'motion-canvas',
@@ -120,6 +120,7 @@ const config = {
'@docusaurus/theme-mermaid',
],
plugins: [
+ './typedoc',
[
'@docusaurus/plugin-content-docs',
{
@@ -143,7 +144,6 @@ const config = {
'@docusaurus/plugin-content-pages',
'@docusaurus/plugin-debug',
'@docusaurus/plugin-sitemap',
- './typedoc',
[
'./editor',
{
diff --git a/packages/docs/src/components/Release/IssueGroup.tsx b/packages/docs/src/components/Release/IssueGroup.tsx
index a95c7b72..10e5a7f1 100644
--- a/packages/docs/src/components/Release/IssueGroup.tsx
+++ b/packages/docs/src/components/Release/IssueGroup.tsx
@@ -1,5 +1,6 @@
-import styles from '@site/src/components/Release/styles.module.css';
import React, {ReactNode} from 'react';
+import styles from '@site/src/components/Release/styles.module.css';
+import Heading from '@theme/Heading';
export interface IssueGroupProps {
type: 'feat' | 'fix';
@@ -7,14 +8,21 @@ export interface IssueGroupProps {
}
const titles = {
- feat: 'New features',
- fix: 'Fixed bugs',
+ feat: 'New features 🎉',
+ fix: 'Fixed bugs 🐛',
+};
+
+const ids = {
+ feat: 'new-features',
+ fix: 'fixed-bugs',
};
export default function IssueGroup({type, children}: IssueGroupProps) {
return (
<>
- <h3>{titles[type]}</h3>
+ <Heading id={ids[type]} as="h3">
+ {titles[type]}
+ </Heading>
<ul className={styles.group}>{children}</ul>
</>
);
diff --git a/packages/docs/src/components/Release/styles.module.css b/packages/docs/src/components/Release/styles.module.css
index ecc4e52e..70ab0535 100644
--- a/packages/docs/src/components/Release/styles.module.css
+++ b/packages/docs/src/components/Release/styles.module.css
@@ -1,9 +1,9 @@
.contributor {
display: inline-flex;
background-color: var(--ifm-background-surface-color);
- vertical-align: middle;
- margin-left: calc(-20px - 0.6rem);
- margin-right: 0.6rem;
+ vertical-align: text-top;
+ margin-left: calc(-20px - 0.5rem);
+ margin-right: 0.5rem;
border-radius: 50%;
overflow: hidden;
}
@@ -12,13 +12,17 @@
display: inline-flex;
background-color: var(--ifm-background-surface-color);
border-radius: 10px;
- vertical-align: middle;
+ vertical-align: text-top;
line-height: 20px;
padding: 0 0.5rem;
margin-left: 0.25rem;
}
+.group {
+ margin-bottom: 2rem;
+}
+
.element {
+ margin-bottom: 1rem;
list-style: none;
- margin-bottom: 0.5rem;
}
diff --git a/packages/docs/src/utils/useStorage.ts b/packages/docs/src/utils/useStorage.ts
index 074d869d..baa6b1aa 100644
--- a/packages/docs/src/utils/useStorage.ts
+++ b/packages/docs/src/utils/useStorage.ts
@@ -5,7 +5,14 @@ export default function useStorage<T>(key: string, initialState: T) {
const isBrowser = useIsBrowser();
const savedState = useMemo(() => {
const savedState = isBrowser && localStorage.getItem(key);
- return savedState ? JSON.parse(savedState) : initialState;
+ if (savedState) {
+ try {
+ return JSON.parse(savedState);
+ } catch (_) {
+ localStorage.removeItem(key);
+ }
+ }
+ return initialState;
}, [key]);
const [state, setState] = useState<T>(savedState);