react-awesome-reveal 5.0.0-next.8 → 5.0.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/reveal.css +24 -0
- package/dist/reveal.css.d.ts +1 -0
- package/package.json +9 -3
- package/skills/migrating-from-v4/SKILL.md +12 -5
package/README.md
CHANGED
|
@@ -8,4 +8,9 @@ import { Reveal } from "react-awesome-reveal";
|
|
|
8
8
|
<Reveal from="left">Hello</Reveal>;
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Two setups need a step for the stylesheet:
|
|
12
|
+
|
|
13
|
+
- In an Astro island, import `react-awesome-reveal/reveal.css` in the page or in the layout that renders the island.
|
|
14
|
+
- In the Next.js Pages Router with webpack, add `@awesome-reveal/react` to `transpilePackages` in the Next.js config. That package imports the stylesheet.
|
|
15
|
+
|
|
11
16
|
For the API and the migration from version 4, read the [React documentation](https://www.npmjs.com/package/@awesome-reveal/react). The package includes the `migrating-from-v4` agent skill. The license is MIT.
|
package/dist/reveal.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* The hold ends, so markup that no script attaches shows again. */
|
|
2
|
+
@media screen and (prefers-reduced-motion: no-preference) {
|
|
3
|
+
[data-awesome-reveal="hidden"],
|
|
4
|
+
[data-awesome-reveal="cascade"] > * {
|
|
5
|
+
animation: awesome-reveal-hold 5s !important;
|
|
6
|
+
}
|
|
7
|
+
[data-awesome-reveal="hidden"][data-awesome-reveal-attached],
|
|
8
|
+
[data-awesome-reveal="cascade"][data-awesome-reveal-attached] > * {
|
|
9
|
+
opacity: 0 !important;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/* A separate query, so browsers without the `scripting` feature still hide. */
|
|
13
|
+
@media (scripting: none) {
|
|
14
|
+
[data-awesome-reveal="hidden"],
|
|
15
|
+
[data-awesome-reveal="cascade"] > * {
|
|
16
|
+
animation: none !important;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
@keyframes awesome-reveal-hold {
|
|
20
|
+
from,
|
|
21
|
+
to {
|
|
22
|
+
opacity: 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-awesome-reveal",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.9",
|
|
4
4
|
"description": "Reveal-on-scroll animations for React. This package re-exports @awesome-reveal/react.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animate-on-scroll",
|
|
@@ -47,20 +47,26 @@
|
|
|
47
47
|
"skills"
|
|
48
48
|
],
|
|
49
49
|
"type": "module",
|
|
50
|
-
"sideEffects":
|
|
50
|
+
"sideEffects": [
|
|
51
|
+
"*.css"
|
|
52
|
+
],
|
|
51
53
|
"types": "dist/index.d.ts",
|
|
52
54
|
"exports": {
|
|
53
55
|
".": {
|
|
54
56
|
"types": "./dist/index.d.ts",
|
|
55
57
|
"default": "./dist/index.js"
|
|
56
58
|
},
|
|
59
|
+
"./reveal.css": {
|
|
60
|
+
"types": "./dist/reveal.css.d.ts",
|
|
61
|
+
"default": "./dist/reveal.css"
|
|
62
|
+
},
|
|
57
63
|
"./package.json": "./package.json"
|
|
58
64
|
},
|
|
59
65
|
"publishConfig": {
|
|
60
66
|
"access": "public"
|
|
61
67
|
},
|
|
62
68
|
"dependencies": {
|
|
63
|
-
"@awesome-reveal/react": "^1.0.0-next.
|
|
69
|
+
"@awesome-reveal/react": "^1.0.0-next.9"
|
|
64
70
|
},
|
|
65
71
|
"devDependencies": {
|
|
66
72
|
"@types/react": "^19.3.0",
|
|
@@ -9,7 +9,7 @@ compatibility: Requires @awesome-reveal/react and React 18 or 19.
|
|
|
9
9
|
|
|
10
10
|
Install `@awesome-reveal/react`, or upgrade `react-awesome-reveal` to version 5. If no other code uses Emotion, remove it. The project must use React 18 or 19.
|
|
11
11
|
|
|
12
|
-
Replace each effect component with `Reveal`, and set `from` to a side or a complete start state. `Reveal` is a named export: `import { Reveal } from "@awesome-reveal/react"`.
|
|
12
|
+
Replace each effect component with `Reveal`, and set `from` to a side or a complete start state. `Reveal` is a named export: `import { Reveal } from "@awesome-reveal/react"`. With `react-awesome-reveal` 5, you can keep the `react-awesome-reveal` import path.
|
|
13
13
|
|
|
14
14
|
`from` names the side where the element starts. The v4 `left` and `right` directions name that side too, but `up` and `down` name the movement, so `up` becomes `from="bottom"` and `down` becomes `from="top"`. For `big` or a diagonal direction, use a `from` object with `x` and `y`. For a complex effect, change the CSS animation into native keyframe objects, with an `offset` and an `easing` for each segment. The last keyframe must agree with the resting style of the element.
|
|
15
15
|
|
|
@@ -28,15 +28,22 @@ import { Reveal } from "@awesome-reveal/react";
|
|
|
28
28
|
</Reveal>;
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
The default entrance starts transparent and 24px below the resting position. It takes 600 ms and plays one time. A `from` object replaces the start state, so it gets no default fade and no offset. The package loads its CSS automatically.
|
|
31
|
+
The default entrance starts transparent and 24px below the resting position. It takes 600 ms and plays one time. A `from` object replaces the start state, so it gets no default fade and no offset. The package loads its CSS automatically. Two setups need a step:
|
|
32
|
+
|
|
33
|
+
- In an Astro island, import `reveal.css` from the package that you install in the page or the layout: `react-awesome-reveal/reveal.css` or `@awesome-reveal/react/reveal.css`.
|
|
34
|
+
- In the Next.js Pages Router with webpack, add `"@awesome-reveal/react"` to `transpilePackages`. Add it also when you install only `react-awesome-reveal`.
|
|
32
35
|
|
|
33
36
|
Check these behavior changes, because the type check does not find them:
|
|
34
37
|
|
|
35
|
-
- A v4 `<Reveal>` with no `keyframes`
|
|
38
|
+
- A v4 `<Reveal>` with no `keyframes` faded in from 100% of its width to the left. Now it fades in and moves up 24px. For the v4 motion, use `from={{ opacity: 0, x: "-100%" }}`.
|
|
36
39
|
- The v4 duration was 1000 ms. Set `duration={1000}` to keep it. The easing is fixed. To change it, use native keyframes.
|
|
37
40
|
- `Reveal` renders one element around its children, and `as` sets its tag. v4 wrapped each element child in a `div`, and animated each `li` of a list child. `className` and `style` now apply to the one element. Style the children directly instead of `childClassName` and `childStyle`.
|
|
38
41
|
- One observer watches the whole `Reveal`, so all the children reveal together.
|
|
39
42
|
|
|
40
|
-
For a long list, use one reveal for each item. Replace the v4 `cascade` prop with the `Cascade` component, which animates its direct element children in sequence. For a v4 cascade around a list, render the list with `Cascade`, for example `<Cascade as="ul">`. Set `interval` to the v4 `duration * damping`, in milliseconds.
|
|
43
|
+
For a long list, use one reveal for each item. Replace the v4 `cascade` prop with the `Cascade` component, which animates its direct element children in sequence. For a v4 cascade around a list, render the list with `Cascade`, for example `<Cascade as="ul">`. Set `interval` to the v4 `duration * damping`, in milliseconds.
|
|
44
|
+
|
|
45
|
+
`Cascade` does not split text. If you need text spans, write them yourself. Do not make screen readers read the same text two times.
|
|
46
|
+
|
|
47
|
+
Replace `fraction` with `threshold`, and use `when` for manual control. Replace `onVisibilityChange` with `onReveal`, which gets the element one time for each reveal. Keep `delay`. It is in milliseconds, and in a cascade it moves the start of the whole sequence. The exit animations (`reverse`) have no replacement.
|
|
41
48
|
|
|
42
|
-
|
|
49
|
+
Remove `triggerOnce`. In v4 the entrance played each time by default, but now it plays one time. To play it again, set `when` to `false`, then to `true`. Use `useReveal` for an element that you render. After the migration, check the refs, hydration, reduced motion and the teardown.
|