Visualize Your Ideas With Code
docs: add 2.4.0 release (#377)
Jacob1b232f1b6904
diff --git a/package-lock.json b/package-lock.jsonindex efce9b94..957ef475 100644--- a/package-lock.json+++ b/package-lock.json@@ -5829,8 +5829,9 @@},"node_modules/@types/mime-types": {"version": "2.1.1",- "dev": true,- "license": "MIT"+ "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.1.tgz",+ "integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==",+ "dev": true},"node_modules/@types/minimatch": {"version": "3.0.5",@@ -14786,7 +14787,8 @@},"node_modules/mime-types": {"version": "2.1.35",- "license": "MIT",+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==","dependencies": {"mime-db": "1.52.0"},@@ -21524,10 +21526,10 @@},"packages/2d": {"name": "@motion-canvas/2d",- "version": "2.3.0",+ "version": "2.4.0","license": "MIT","dependencies": {- "@motion-canvas/core": "^2.3.0",+ "@motion-canvas/core": "^2.4.0","code-fns": "^0.8.2","mathjax-full": "^3.2.2"},@@ -21537,7 +21539,7 @@},"packages/core": {"name": "@motion-canvas/core",- "version": "2.3.0",+ "version": "2.4.0","license": "MIT","dependencies": {"@types/chroma-js": "^2.1.4",@@ -21554,7 +21556,7 @@},"packages/create": {"name": "@motion-canvas/create",- "version": "2.3.0",+ "version": "2.4.0","license": "MIT","dependencies": {"prompts": "^2.4.2"@@ -21563,10 +21565,10 @@"create-motion-canvas": "index.js"},"devDependencies": {- "@motion-canvas/2d": "^2.3.0",- "@motion-canvas/core": "^2.3.0",- "@motion-canvas/ui": "^2.3.0",- "@motion-canvas/vite-plugin": "^2.2.0"+ "@motion-canvas/2d": "^2.4.0",+ "@motion-canvas/core": "^2.4.0",+ "@motion-canvas/ui": "^2.4.0",+ "@motion-canvas/vite-plugin": "^2.4.0"}},"packages/docs": {@@ -21635,10 +21637,10 @@},"packages/player": {"name": "@motion-canvas/player",- "version": "2.3.0",+ "version": "2.4.0","license": "MIT","devDependencies": {- "@motion-canvas/core": "^2.3.0",+ "@motion-canvas/core": "^2.4.0","sass": "^1.58.0","terser": "^5.16.1"}@@ -21658,10 +21660,10 @@},"packages/ui": {"name": "@motion-canvas/ui",- "version": "2.3.0",+ "version": "2.4.0","license": "MIT","dependencies": {- "@motion-canvas/core": "^2.3.0"+ "@motion-canvas/core": "^2.4.0"},"devDependencies": {"@preact/preset-vite": "^2.3.0",@@ -21674,7 +21676,7 @@},"packages/vite-plugin": {"name": "@motion-canvas/vite-plugin",- "version": "2.2.0",+ "version": "2.4.0","license": "MIT","dependencies": {"mime-types": "^2.1.35"@@ -24909,7 +24911,7 @@"@motion-canvas/2d": {"version": "file:packages/2d","requires": {- "@motion-canvas/core": "^2.3.0",+ "@motion-canvas/core": "^2.4.0","@motion-canvas/internal": "0.0.0","code-fns": "^0.8.2","mathjax-full": "^3.2.2"@@ -24928,10 +24930,10 @@"@motion-canvas/create": {"version": "file:packages/create","requires": {- "@motion-canvas/2d": "^2.3.0",- "@motion-canvas/core": "^2.3.0",- "@motion-canvas/ui": "^2.3.0",- "@motion-canvas/vite-plugin": "^2.2.0",+ "@motion-canvas/2d": "^2.4.0",+ "@motion-canvas/core": "^2.4.0",+ "@motion-canvas/ui": "^2.4.0",+ "@motion-canvas/vite-plugin": "^2.4.0","prompts": "^2.4.2"}},@@ -24989,7 +24991,7 @@"@motion-canvas/player": {"version": "file:packages/player","requires": {- "@motion-canvas/core": "^2.3.0",+ "@motion-canvas/core": "^2.4.0","sass": "^1.58.0","terser": "^5.16.1"}@@ -25006,7 +25008,7 @@"@motion-canvas/ui": {"version": "file:packages/ui","requires": {- "@motion-canvas/core": "^2.3.0",+ "@motion-canvas/core": "^2.4.0","@preact/preset-vite": "^2.3.0","clsx": "^1.2.1","highlight.js": "^11.7.0",@@ -25747,6 +25749,8 @@},"@types/mime-types": {"version": "2.1.1",+ "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.1.tgz",+ "integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==","dev": true},"@types/minimatch": {@@ -31391,6 +31395,8 @@},"mime-types": {"version": "2.1.35",+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==","requires": {"mime-db": "1.52.0"}diff --git a/packages/docs/blog/2023-02-18-version-2.4.0.mdx b/packages/docs/blog/2023-02-18-version-2.4.0.mdxnew file mode 100644index 00000000..b695c6b8--- /dev/null+++ b/packages/docs/blog/2023-02-18-version-2.4.0.mdx@@ -0,0 +1,72 @@+---+slug: version-2.4.0+title: Motion Canvas v2.4.0+authors: aarthificial+---++### Features++- [`DEFAULT`](/docs/signals#default-values) signal values. `lineHeight` now+ supports percentages.+ ([#259](https://github.com/motion-canvas/motion-canvas/issues/259))+ ([18f61a6](https://github.com/motion-canvas/motion-canvas/commit/18f61a668420dec8afba52d52a6557e7a7919ba2))+- New [`moveBelow`](/api/2d/components/Node#moveBelow),+ [`moveAbove`](/api/2d/components/Node#moveAbove) and+ [`moveTo`](/api/2d/components/Node#moveTo) methods for rearranging the nodes.+ ([#365](https://github.com/motion-canvas/motion-canvas/issues/365))+ ([16752a3](https://github.com/motion-canvas/motion-canvas/commit/16752a3b8ae7461b33d6208a9675729f374e8324))+- New [`CodeBlock`](/docs/code-block) documentation+ ([#302](https://github.com/motion-canvas/motion-canvas/issues/302))+ ([73f7221](https://github.com/motion-canvas/motion-canvas/commit/73f7221536e09d5cf77f75ca173d1a7637d5b98f))+- The editor now warns about duplicated time events.+ ([#341](https://github.com/motion-canvas/motion-canvas/issues/341))+ ([053b2a6](https://github.com/motion-canvas/motion-canvas/commit/053b2a6c22c4e726e3962fdaf0a2e8d149889a9b))+- We now have a search bar on the documentation website.+ ([#335](https://github.com/motion-canvas/motion-canvas/issues/335))+ ([48f74a6](https://github.com/motion-canvas/motion-canvas/commit/48f74a60d54cc52c7f069a9ec39071c99163bd19))+- You can now open the documentation from within the editor.+ ([#346](https://github.com/motion-canvas/motion-canvas/issues/346))+ ([fc4ee5d](https://github.com/motion-canvas/motion-canvas/commit/fc4ee5d028312904ed9e11c5341ac00f36e7242b))+- `SHIFT + ->` moves to the last frame.+ ([#354](https://github.com/motion-canvas/motion-canvas/issues/354))+ ([4b81709](https://github.com/motion-canvas/motion-canvas/commit/4b8170971400c5bf4fe690a58d3f44c3e1d00b94)),+ closes [#353](https://github.com/motion-canvas/motion-canvas/issues/353)+- Flexbox `gap` is now represented by a `Vector2` signal.+ ([#355](https://github.com/motion-canvas/motion-canvas/issues/355))+ ([3cae97e](https://github.com/motion-canvas/motion-canvas/commit/3cae97ea704d0533020fa87326dacadcc037d517)),+ closes [#352](https://github.com/motion-canvas/motion-canvas/issues/352)+- New [`Matrix2D`](/api/core/types/Matrix2D) type.+ ([#340](https://github.com/motion-canvas/motion-canvas/issues/340))+ ([66b41e6](https://github.com/motion-canvas/motion-canvas/commit/66b41e6beaca5c2ba4b6bd1a7e68ca16d183b0e9))++### Bug Fixes++- **2d:** fix Gradient and Pattern signals+ ([#376](https://github.com/motion-canvas/motion-canvas/issues/376))+ ([6e0dc8a](https://github.com/motion-canvas/motion-canvas/commit/6e0dc8af8d19f93fd6a42addca2b3a2958b4dd33))+- **2d:** fix layout calculation for nodes not explicitly added to view+ ([#331](https://github.com/motion-canvas/motion-canvas/issues/331))+ ([528e2d5](https://github.com/motion-canvas/motion-canvas/commit/528e2d5a0abec99819e022d2848b256ece9f869a))+- **2d:** format whitespaces according to HTML+ ([#372](https://github.com/motion-canvas/motion-canvas/issues/372))+ ([83fb565](https://github.com/motion-canvas/motion-canvas/commit/83fb565742d98f060c0400c8cbaf9961b69f34d0)),+ closes [#370](https://github.com/motion-canvas/motion-canvas/issues/370)+- **core:** playback speed is reset after saving with faulty code+ ([#204](https://github.com/motion-canvas/motion-canvas/issues/204)).+ ([#339](https://github.com/motion-canvas/motion-canvas/issues/339))+ ([6771e5e](https://github.com/motion-canvas/motion-canvas/commit/6771e5e17edcdc4cce074d7da0962cf71ba6c228))+- **docs:** fix search+ ([#336](https://github.com/motion-canvas/motion-canvas/issues/336))+ ([e44ec02](https://github.com/motion-canvas/motion-canvas/commit/e44ec02539a67f099471a6aa84f673a236494687))+- typo on codeblock remove comments+ ([#368](https://github.com/motion-canvas/motion-canvas/issues/368))+ ([2025adc](https://github.com/motion-canvas/motion-canvas/commit/2025adc6e7aa11d81b6f5f6989e8eae18cf86cb7))+- **ui:** fix inspector tab+ ([#374](https://github.com/motion-canvas/motion-canvas/issues/374))+ ([c4cb378](https://github.com/motion-canvas/motion-canvas/commit/c4cb378c2f9d972bb41542bbe3b3aa314fa1f3ad))+- **vite-plugin:** fix js template+ ([#337](https://github.com/motion-canvas/motion-canvas/issues/337))+ ([3b33d73](https://github.com/motion-canvas/motion-canvas/commit/3b33d73416541d491b633bada29f085f5489f6c2))+- **vite-plugin:** ignore query param in devserver+ ([#351](https://github.com/motion-canvas/motion-canvas/issues/351))+ ([5644d72](https://github.com/motion-canvas/motion-canvas/commit/5644d72d36adcdc817f0856aaff0be5507338cb8))diff --git a/packages/docs/config/darkCodeTheme.js b/packages/docs/config/darkCodeTheme.jsindex 104374aa..13425d2a 100644--- a/packages/docs/config/darkCodeTheme.js+++ b/packages/docs/config/darkCodeTheme.js@@ -6,4 +6,13 @@ module.exports = {color: '#f8f8f8',backgroundColor: 'var(--code-background-color)',},+ styles: [+ ...darkCodeTheme.styles,+ {+ types: ['constant'],+ style: {+ color: 'rgb(184,165,232)',+ },+ },+ ],};diff --git a/packages/docs/docs/getting-started/signals.mdx b/packages/docs/docs/getting-started/signals.mdxindex eca27327..86f4e449 100644--- a/packages/docs/docs/getting-started/signals.mdx+++ b/packages/docs/docs/getting-started/signals.mdx@@ -117,6 +117,51 @@ recalculated immediately - laziness is still at play. We can modify the radiushowever many times we want, but the `area` will be recalculated only once itsvalue is requested again by calling `area()`.+## `DEFAULT` values++Signals keep track of the initial values specified during creation. At any time,+we can reset a signal to its initial value by passing the+[`DEFAULT`](/api/core/signals#DEFAULT) symbol to it:++```ts+import {DEFAULT, createSignal} from '@motion-canvas/core/lib/signals';++const signal = createSignal(3); // <- initial value is 3+signal(2);+signal(); // <- value is now 2+signal(DEFAULT);+signal(); // <- value is reset back to 3+```++We can also use the [`DEFAULT`](/api/core/signals#DEFAULT) symbol for+[tweening](/docs/tweening):++```ts+yield * signal(DEFAULT, 2);+```++Resetting to the default value is especially useful with node properties. In the+example below, we set the [`lineHeight`](/api/2d/components/Layout#lineHeight)+of the [`Text`](/api/2d/components/Text) node to `150%`. This will override its+default value, which would be simply inherited from its parent:++```tsx+const text = createRef<Text>();+view.add(+ <Text lineHeight={'150%'} ref={text}>+ Hello world!+ </Text>,+);+```++If we want to reset the [`lineHeight`](/api/2d/components/Layout#lineHeight)+back to the default, inherited value, we can do so with+[`DEFAULT`](/api/core/signals#DEFAULT):++```ts+text().lineHeight(DEFAULT);+```+## Complex exampleWe can use the fact that properties of nodes are represented by signals to