Compare commits

...

34 Commits

Author SHA1 Message Date
caudetgit
ed90c7f7c9 chore: release 3.0.44 2023-04-19 20:10:23 +00:00
Chad Audet
e06fdd1c8b Create add_to_project.yml
workflow that adds each new issue to the Runtime Issue Board
2023-04-19 13:07:28 -07:00
zplata
b8ffb6b53c chore: release 3.0.43 2023-04-14 15:52:47 +00:00
Zach Plata
2dc925ef70 patch: bump rive-wasm to take path fix 2023-04-14 10:49:40 -05:00
zplata
639de79c9e chore: release 3.0.42 2023-04-13 02:19:19 +00:00
Zach Plata
a9961c821a chore: bump rive-wasm to get solo patch 2023-04-12 21:16:29 -05:00
zplata
fc082d1a03 chore: release 3.0.41 2023-04-06 21:50:50 +00:00
Zach Plata
87fa1ae2a5 patch: bump wasm dependency for blend state enhancements 2023-04-06 16:48:11 -05:00
zplata
62490a50f9 chore: release 3.0.40 2023-04-05 20:47:45 +00:00
Zach Plata
fcc1a16df4 feature: Add support for touch and drag interactions on canvas 2023-04-05 15:44:36 -05:00
zplata
29e0ceb797 chore: release 3.0.39 2023-03-30 18:08:35 +00:00
Zach Plata
3e6a951ca1 fix: bump wasm dependency for clipping issue fix 2023-03-30 13:05:41 -05:00
zplata
04910f78f1 chore: release 3.0.38 2023-03-03 20:43:32 +00:00
Zach Plata
c2977c705c maint: bump wasm dependency for more speed on state updates 2023-03-03 14:40:24 -06:00
zplata
4e2137422b chore: release 3.0.37 2023-03-01 15:54:14 +00:00
Zach Plata
0696417926 maint: bump wasm dependency for more speed on state updates 2023-03-01 09:51:04 -06:00
zplata
f11a433365 chore: release 3.0.36 2023-02-22 19:03:57 +00:00
Zach Plata
48a4726d1f maint: bump wasm to support speed on states feature 2023-02-22 13:01:16 -06:00
Dillon Pentz
c927f24b5a Fix link to blog article 2023-01-18 14:44:57 -06:00
elVengador
3cbbf99fec Fix: matchMedia add event listener for safari 13 and older versions 2023-01-18 10:12:34 -06:00
zplata
03f05f57b7 chore: release 3.0.35 2023-01-17 20:15:23 +00:00
Zach Plata
8b483b807b fix: update rive-wasm to try patching slow burn memory leak 2023-01-17 14:12:39 -06:00
luigi-rosso
816fcfcdbc chore: release 3.0.34 2022-12-16 19:29:15 +00:00
Luigi Rosso
6c28a8795e Bumping rive-app/canvas & webgl versions. 2022-12-16 11:25:51 -08:00
zplata
6a57630ae6 chore: release 3.0.33 2022-11-08 20:15:00 +00:00
Zach Plata
acba24c4ed maint: bump wasm runtime and replace old skills rive file example 2022-11-08 14:10:33 -06:00
luigi-rosso
1e6eb5ec92 chore: release 3.0.32 2022-10-21 20:38:27 +00:00
Luigi Rosso
6871a81ebd Bumping to latest Rive WASM to fix https://2dimensions.slack.com/archives/CLLCU09T6/p1666370141425879 2022-10-21 13:35:28 -07:00
mjtalbot
33053b3b7f chore: release 3.0.31 2022-10-21 13:20:16 +00:00
Maxwell Talbot
4040083d5a bump runtimes to incorporate speed fix for state machines 2022-10-21 14:17:25 +01:00
avivian
2153b81e6b chore: release 3.0.30 2022-10-20 18:34:05 +00:00
Arthur Vivian
6b1500e681 Bump dependencies to fix call to runtime cleanup 2022-10-20 19:31:16 +01:00
avivian
503702cf1f chore: release 3.0.29 2022-10-20 17:06:43 +00:00
Arthur Vivian
7be20b0a87 Call cleanup on unmount 2022-10-20 18:03:30 +01:00
9 changed files with 160 additions and 21 deletions

19
.github/workflows/add_to_project.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Adds all new issues to project board
on:
issues:
types:
- opened
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/rive-app/projects/12/views/1
github-token: ${{ secrets.ADD_TO_PROJECT_ACTION }}
# repo-token: '${{ secrets.ADD_TO_PROJECT_ACTION }}'
# labeled: bug, needs-triage
# label-operator: NOT

View File

@@ -4,10 +4,117 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [v3.0.28](https://github.com/rive-app/rive-react/compare/v3.0.23...v3.0.28)
#### [v3.0.44](https://github.com/rive-app/rive-react/compare/v3.0.38...v3.0.44)
- Create add_to_project.yml [`e06fdd1`](https://github.com/rive-app/rive-react/commit/e06fdd1c8be9c6fe224d6ec83547965d773f633c)
#### [v3.0.38](https://github.com/rive-app/rive-react/compare/v3.0.37...v3.0.38)
> 3 March 2023
- chore: release 3.0.38 [`04910f7`](https://github.com/rive-app/rive-react/commit/04910f78f1779242626db0dfb74ab27ae95c75fa)
- maint: bump wasm dependency for more speed on state updates [`c2977c7`](https://github.com/rive-app/rive-react/commit/c2977c705c5572480be3f253b7237bdc2d3eea35)
#### [v3.0.37](https://github.com/rive-app/rive-react/compare/v3.0.36...v3.0.37)
> 1 March 2023
- chore: release 3.0.37 [`4e21374`](https://github.com/rive-app/rive-react/commit/4e2137422b8c1d135a6501add3f2cc68140f1817)
- maint: bump wasm dependency for more speed on state updates [`0696417`](https://github.com/rive-app/rive-react/commit/06964179262d4b79114f3609d79cc6560c30ef94)
#### [v3.0.36](https://github.com/rive-app/rive-react/compare/v3.0.35...v3.0.36)
> 22 February 2023
- chore: release 3.0.36 [`f11a433`](https://github.com/rive-app/rive-react/commit/f11a433365c34818976798106fc03a264e6ceaea)
- Fix: matchMedia add event listener for safari 13 and older versions [`3cbbf99`](https://github.com/rive-app/rive-react/commit/3cbbf99fec90f58cdf410df861f272115a7704e6)
- maint: bump wasm to support speed on states feature [`48a4726`](https://github.com/rive-app/rive-react/commit/48a4726d1f7a01088959d47580082e5ddfed1492)
#### [v3.0.35](https://github.com/rive-app/rive-react/compare/v3.0.34...v3.0.35)
> 17 January 2023
- chore: release 3.0.35 [`03f05f5`](https://github.com/rive-app/rive-react/commit/03f05f57b7f277d7d90701954b5ca09842bcaab6)
- fix: update rive-wasm to try patching slow burn memory leak [`8b483b8`](https://github.com/rive-app/rive-react/commit/8b483b807b8207fe12c864e19f64592c0bedac46)
#### [v3.0.34](https://github.com/rive-app/rive-react/compare/v3.0.33...v3.0.34)
> 16 December 2022
- chore: release 3.0.34 [`816fcfc`](https://github.com/rive-app/rive-react/commit/816fcfcdbcb9f2d8f83cc7887f43aae011dee3be)
- Bumping rive-app/canvas & webgl versions. [`6c28a87`](https://github.com/rive-app/rive-react/commit/6c28a8795eeabc10aa8bdcee99ee9754d924d0ae)
#### [v3.0.33](https://github.com/rive-app/rive-react/compare/v3.0.32...v3.0.33)
> 8 November 2022
- maint: bump wasm runtime and replace old skills rive file example [`acba24c`](https://github.com/rive-app/rive-react/commit/acba24c4ed4f703303615819678c7273c385286f)
- chore: release 3.0.33 [`6a57630`](https://github.com/rive-app/rive-react/commit/6a57630ae67df057472a6d40f354fcfe53cb5521)
#### [v3.0.32](https://github.com/rive-app/rive-react/compare/v3.0.31...v3.0.32)
> 21 October 2022
- chore: release 3.0.32 [`1e6eb5e`](https://github.com/rive-app/rive-react/commit/1e6eb5ec927aa0bb10ee1e7659c4824c64702f58)
- Bumping to latest Rive WASM to fix https://2dimensions.slack.com/archives/CLLCU09T6/p1666370141425879 [`6871a81`](https://github.com/rive-app/rive-react/commit/6871a81ebd17038426e7089ed836379d02a9c5fd)
#### [v3.0.31](https://github.com/rive-app/rive-react/compare/v3.0.30...v3.0.31)
> 21 October 2022
- chore: release 3.0.31 [`33053b3`](https://github.com/rive-app/rive-react/commit/33053b3b7f0ff6d99ce4383ecea1f031ccb587e0)
- bump runtimes to incorporate speed fix for state machines [`4040083`](https://github.com/rive-app/rive-react/commit/4040083d5a89510356e45433e5026664baf92a49)
#### [v3.0.30](https://github.com/rive-app/rive-react/compare/v3.0.29...v3.0.30)
> 20 October 2022
- chore: release 3.0.30 [`2153b81`](https://github.com/rive-app/rive-react/commit/2153b81e6b74d33d1e2f709291fad338dcbb85da)
- Bump dependencies to fix call to runtime cleanup [`6b1500e`](https://github.com/rive-app/rive-react/commit/6b1500e681ba8984d786eec4d414c4c8ad4b0268)
#### [v3.0.29](https://github.com/rive-app/rive-react/compare/v3.0.28...v3.0.29)
> 20 October 2022
- chore: release 3.0.29 [`503702c`](https://github.com/rive-app/rive-react/commit/503702cf1f963204e3519b9b3dbfea1bfa271d0a)
- Call cleanup on unmount [`7be20b0`](https://github.com/rive-app/rive-react/commit/7be20b0a874afab7f6a29122521f42c71a22aa51)
#### [v3.0.28](https://github.com/rive-app/rive-react/compare/v3.0.27...v3.0.28)
> 20 October 2022
- chore: release 3.0.28 [`78491f5`](https://github.com/rive-app/rive-react/commit/78491f5819b78b2e7435a2509e89fd3c672f3126)
- Bump canvas and webgl dependencies to fix alignment memory leaks [`39edb88`](https://github.com/rive-app/rive-react/commit/39edb88a19aaff478e4e9cbeeef58414f28fdb60)
#### [v3.0.27](https://github.com/rive-app/rive-react/compare/v3.0.26...v3.0.27)
> 4 October 2022
- chore: release 3.0.27 [`fd1a165`](https://github.com/rive-app/rive-react/commit/fd1a1653b13c2fd15f2862e6c372a27fd49acd00)
- Fix: Bump wasm to accomodate clipping bug on nested artboards [`8d7f0ab`](https://github.com/rive-app/rive-react/commit/8d7f0ab28c8aa6af3abe5269e7b8980cc1a8dbe7)
#### [v3.0.26](https://github.com/rive-app/rive-react/compare/v3.0.25...v3.0.26)
> 22 September 2022
- fix: Adjust canvas size if devicePixelRatio changes for any reaason [`2b1aa01`](https://github.com/rive-app/rive-react/commit/2b1aa01a87c14f71b980d160f6607edc12d3eed6)
- chore: release 3.0.26 [`2a2e532`](https://github.com/rive-app/rive-react/commit/2a2e53256401b6d7137db4b73c5901d587a888af)
#### [v3.0.25](https://github.com/rive-app/rive-react/compare/v3.0.24...v3.0.25)
> 21 September 2022
- chore: release 3.0.25 [`06c4e2a`](https://github.com/rive-app/rive-react/commit/06c4e2aea39d8e08ee12760663bd612ca77f3e9c)
- patch: bump js runtime dependency to address content security policy issue in WASM build [`819bd51`](https://github.com/rive-app/rive-react/commit/819bd51ea976bbea0c218379cd88304bd1738323)
#### [v3.0.24](https://github.com/rive-app/rive-react/compare/v3.0.23...v3.0.24)
> 15 September 2022
- add tests [`a62e9b3`](https://github.com/rive-app/rive-react/commit/a62e9b3a9aeb51b71c441ea1560eea6431704ee7)
- chore: release 3.0.24 [`6b7f113`](https://github.com/rive-app/rive-react/commit/6b7f1132964dafe9783f0a79782a2ba20638c7ce)
- fix: make a canvas of size 0 until we calculate the bounds appropriately [`04685c0`](https://github.com/rive-app/rive-react/commit/04685c0bcda26ee0451ab8cc9fc09436e94d04f6)
#### [v3.0.23](https://github.com/rive-app/rive-react/compare/v3.0.22...v3.0.23)
> 31 August 2022

View File

@@ -50,7 +50,7 @@ Check out our Storybook instance that shows how to use the library in small exam
- [Example page](https://rive-app.github.io/rive-react)
- [Login screen w/ input tracking](https://rive-app.github.io/rive-use-cases/?path=/story/example-loginformcomponent--primary)
- [Mouse tracking](https://codesandbox.io/s/rive-mouse-track-test-t0y965?file=/src/App.js)
- [Accessibility concerns](https://blog.rive.app/accessible-web-animations-aria-live-regions/)
- [Accessibility concerns](https://rive.app/blog/accesible-web-animations-aria-live-regions)
## Migration Guides

View File

@@ -4,8 +4,8 @@ import { useState } from 'react';
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
import RiveComponent, {useRive, useStateMachineInput} from '../../src';
import {Button} from './components/Button';
import RiveComponent, { useRive, useStateMachineInput } from '../../src';
import { Button } from './components/Button';
import './rive-overview.css';
<Meta title="React Runtime/State Machines" />
@@ -15,6 +15,7 @@ import './rive-overview.css';
Not familiar with Rive State Machines? Check out our [help docs](https://help.rive.app/editor/state-machine) on what these are first!
The `useStateMachineInput` hook is a helper that makes grabbing references to state machine inputs easier to setup. This hook should be used along with the `useRive` hook, as you need to pass in the `rive` instance returned from `useRive`. See each of the examples below to see usage of the hook creating instance of three types of inputs:
- Booleans
- Numbers
- Triggers
@@ -90,8 +91,8 @@ Once you grab a reference to the state machine input, you can get/set the value
<Canvas withSource="open">
<Story name="Number input">
{() => {
const STATE_MACHINE_NAME = 'State Machine ';
const INPUT_NAME = 'Level';
const STATE_MACHINE_NAME = 'skill-controller';
const INPUT_NAME = 'level';
const { rive, RiveComponent: RiveComponentTouch } = useRive({
src: 'skills.riv',
stateMachines: STATE_MACHINE_NAME,
@@ -101,7 +102,11 @@ Once you grab a reference to the state machine input, you can get/set the value
// levelInput is a number state machine input. To transition the state machine,
// we need to set the value to a number. For this state machine input, we need
// to set to 0, 1 or 2 for a state transition to occur.
const levelInput = useStateMachineInput(rive, STATE_MACHINE_NAME, INPUT_NAME);
const levelInput = useStateMachineInput(
rive,
STATE_MACHINE_NAME,
INPUT_NAME
);
return (
// The animation will fit to the parent element, so we set a large height
// and width for this example.

View File

Binary file not shown.

View File

@@ -1,6 +1,6 @@
{
"name": "rive-react",
"version": "3.0.28",
"version": "3.0.44",
"description": "React wrapper around the rive-js library",
"main": "dist/index.js",
"typings": "dist/types/index.d.ts",
@@ -29,8 +29,8 @@
},
"homepage": "https://github.com/rive-app/rive-react#readme",
"dependencies": {
"@rive-app/canvas": "1.0.89",
"@rive-app/webgl": "1.0.85"
"@rive-app/canvas": "1.1.3",
"@rive-app/webgl": "1.1.3"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"

View File

@@ -215,6 +215,9 @@ export default function useRive(
// on an unmounted component in some rare cases
if (canvasRef.current) {
setRive(r);
} else {
// If unmounted, cleanup the rive object immediately
r.cleanup();
}
});
} else if (canvas === null && canvasRef.current) {
@@ -257,12 +260,13 @@ export default function useRive(
}, [rive]);
/**
* On unmount, stop rive from rendering.
* On unmount, call cleanup to cleanup any WASM generated objects that need
* to be manually destroyed.
*/
useEffect(() => {
return () => {
if (rive) {
rive.stop();
rive.cleanup();
setRive(null);
}
};

View File

@@ -3,9 +3,9 @@ import { Dimensions } from './types';
// There are polyfills for this, but they add hundreds of lines of code
class FakeResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
observe() { }
unobserve() { }
disconnect() { }
}
function throttle(f: Function, delay: number) {
@@ -106,10 +106,14 @@ export function useDevicePixelRatio() {
const mediaMatcher = window.matchMedia(
`screen and (resolution: ${currentDpr}dppx)`
);
mediaMatcher.addEventListener('change', updateDpr);
mediaMatcher.hasOwnProperty('addEventListener')
? mediaMatcher.addEventListener('change', updateDpr)
: mediaMatcher.addListener(updateDpr);
return () => {
mediaMatcher.removeEventListener('change', updateDpr);
mediaMatcher.hasOwnProperty('removeEventListener')
? mediaMatcher.removeEventListener('change', updateDpr)
: mediaMatcher.removeListener(updateDpr);
};
}, [currentDpr]);

View File

@@ -102,16 +102,16 @@ describe('useRive', () => {
expect(resizeToCanvasMock).toBeCalled();
});
it('stops the rive object on unmount', async () => {
it('calls cleanup on the rive object on unmount', async () => {
const params = {
src: 'file-src',
};
const stopMock = jest.fn();
const cleanupMock = jest.fn();
const riveMock = {
...baseRiveMock,
stop: stopMock,
cleanup: cleanupMock,
};
// @ts-ignore
@@ -127,7 +127,7 @@ describe('useRive', () => {
unmount();
expect(stopMock).toBeCalled();
expect(cleanupMock).toBeCalled();
});
it('sets the a bounds with the devicePixelRatio by default', async () => {