Skip to content

Commit 7febf71

Browse files
committed
Merge branch 'release/0.6.0' into main
2 parents cea57ef + 19ea966 commit 7febf71

File tree

11 files changed

+317
-298
lines changed

11 files changed

+317
-298
lines changed

.github/workflows/main.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ jobs:
2020
new-version: ${{ toJSON(steps.package-version.outputs.current-version != steps.latest-tag.outputs.tag) }}
2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
2424
with:
2525
# Disabling shallow clone is recommended for improving relevancy of reporting
2626
fetch-depth: 0
2727

2828
- name: Setup Node.js
29-
uses: actions/setup-node@v2
29+
uses: actions/setup-node@v3
3030
with:
3131
node-version: '14'
3232

3333
- name: Cache dependencies
34-
uses: actions/cache@v2
34+
uses: actions/cache@v3
3535
env:
3636
cache-name: cache-dependencies
3737
with:
@@ -87,17 +87,17 @@ jobs:
8787
echo "New version: ${{ fromJSON(needs.CI.outputs.new-version) }}"
8888
8989
- name: Checkout code
90-
uses: actions/checkout@v2
90+
uses: actions/checkout@v3
9191
with:
9292
fetch-depth: 0 # Required due to the weg Git works, without it this action won't be able to find any or the correct tags
9393

9494
- name: Setup Node.js
95-
uses: actions/setup-node@v2
95+
uses: actions/setup-node@v3
9696
with:
9797
node-version: '14'
9898

9999
- name: Cache dependencies
100-
uses: actions/cache@v2
100+
uses: actions/cache@v3
101101
env:
102102
cache-name: cache-dependencies
103103
with:
@@ -124,7 +124,7 @@ jobs:
124124
# DOCKER
125125

126126
- name: Cache Docker layers
127-
uses: actions/cache@v2
127+
uses: actions/cache@v3
128128
with:
129129
path: /tmp/.buildx-cache
130130
key: ${{ runner.os }}-buildx-${{ github.sha }}

CHANGELOG.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
## [0.6.0] - 2022-04-22
11+
### Added
12+
- Created unit tests for new modules
13+
14+
### Changed
15+
- Version numbers in CHANGELOG now allow to compare changes with previous release
16+
- Separated some business logic into separate modules
17+
- Updated README with CSS requirements for scale and spin transitions
18+
19+
### Removed
20+
- Vendor prefixes are not added anymore
21+
22+
### Fixed
23+
- Fixed and improved README (emojis have been removed from the headings to fix broken links)
24+
- Fixed some JSDoc typos
25+
826
## [0.5.0] - 2022-03-15
927
### Changed
1028
- Documented how to use svelte-reveal with SvelteKit
@@ -56,4 +74,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5674
- Better naming in GitHub CI workflow
5775

5876
## [0.1.0] - 2021-11-16
59-
- Initial beta release
77+
- Initial beta release
78+
79+
[0.1.0]: https://github.com/DaveKeehl/svelte-reveal/releases/tag/0.1.0
80+
[0.2.0]: https://github.com/DaveKeehl/svelte-reveal/compare/0.1.0...0.2.0
81+
[0.3.0]: https://github.com/DaveKeehl/svelte-reveal/compare/0.2.0...0.3.0
82+
[0.3.1]: https://github.com/DaveKeehl/svelte-reveal/compare/0.3.0...0.3.1
83+
[0.3.2]: https://github.com/DaveKeehl/svelte-reveal/compare/0.3.1...0.3.2
84+
[0.3.3]: https://github.com/DaveKeehl/svelte-reveal/compare/0.3.2...0.3.3
85+
[0.4.0]: https://github.com/DaveKeehl/svelte-reveal/compare/0.3.3...0.4.0
86+
[0.5.0]: https://github.com/DaveKeehl/svelte-reveal/compare/0.4.0...0.5.0
87+
[0.6.0]: https://github.com/DaveKeehl/svelte-reveal/compare/0.5.0...0.6.0

README.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
99
svelte-reveal is a library created with the purpose of helping [Svelte](https://svelte.dev/) users add reveal on scroll transitions to their web applications. This library leverages the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) in order to know when to trigger the animations.
1010

11-
##   Features
11+
## Features
1212

1313
- Zero config Svelte action
1414
- Highly customizable transitions
1515
- Integrates a performant intersection observer
1616
- TypeScript ready
1717

18-
## 📖  Table of Content
18+
## Table of Content
1919

2020
1. [Usage](#usage)
2121
2. [Demo](#demo)
@@ -31,7 +31,7 @@ svelte-reveal is a library created with the purpose of helping [Svelte](https://
3131
12. [Changelog](#changelog)
3232
13. [License](#license)
3333

34-
## 🔨  Usage
34+
## Usage
3535

3636
1. Install the library. You can use either [npm](https://www.npmjs.com/):
3737

@@ -83,7 +83,7 @@ svelte-reveal is a library created with the purpose of helping [Svelte](https://
8383

8484
4. Using [SvelteKit](https://kit.svelte.dev/)? Please read [section "SvelteKit"](#sveltekit)
8585

86-
### 🐳  Docker
86+
### Docker
8787

8888
A Docker image is also available on [DockerHub](https://hub.docker.com/):
8989

@@ -93,19 +93,19 @@ docker pull davekeehl/svelte-reveal:latest
9393

9494
You can also use the provided Dockerfile in the repository as a development environment. You can read more [here](https://code.visualstudio.com/docs/remote/containers).
9595

96-
## 🕺🏻  Demo
96+
## Demo
9797

9898
In this [Svelte REPL](https://svelte.dev/repl/1cf37b0947ac46b8ae9cc791abda7159?version=3.44.1) I created you can see svelte-reveal in action.
9999

100-
## 🤔  Why svelte-reveal
100+
## Why svelte-reveal
101101

102102
If you happened to scout the internet for other similar libraries, you would have noticed that other authors have decided to create their own library using Svelte [slots](https://svelte.dev/docs#slot) (similar to [React children](https://reactjs.org/docs/composition-vs-inheritance.html)). There is nothing wrong with that approach, but in my opinion it goes a bit against one of Svelte's core purposes: writing less code. Having to wrap every to-be-transitioned component adds 2 extra lines of code each time, making your files unnecessarily bloated for such a simple add-on.
103103

104104
You might have also noticed people adding event listeners to the window object, but in terms of performance that [doesn't scale very well](https://itnext.io/1v1-scroll-listener-vs-intersection-observers-469a26ab9eb6).
105105

106106
Instead, I decided to use Svelte [actions](https://svelte.dev/docs#use_action), which are functions you can attach to a DOM element and that allow you to get access to that element and its lifecycle. They take up considerably less space and so far I haven't encountered any obstacle or performance drawback. Morever, this library is backed by the Intersection Observer API, which is great for performance.
107107

108-
## ⚠️  SvelteKit
108+
## SvelteKit
109109

110110
The way svelte-reveal transitions the elements does not work well with [SSR](https://kit.svelte.dev/docs/appendix#ssr), which is enabled by default on SvelteKit. One way to get around this issue is to wrap your top-most element or component inside an if-block that is evaluated to `true` only when its context has been updated, as in the following example.
111111

@@ -123,11 +123,11 @@ In case of problems, please create a new issue and submit a bug report.
123123
</script>
124124

125125
{#if show}
126-
<your-element-or-component />
126+
<your-element-or-component />
127127
{/if}
128128
```
129129

130-
## &nbsp;&nbsp;Options
130+
## Options
131131

132132
Depending on the use case, you can either use this library as-is (which applies some [default styles](https://github.com/DaveKeehl/svelte-reveal/blob/main/src/internal/config.ts#L6-L37)), or customize it to your liking. If you choose to do so, you can pass an object to this action containing additional options.
133133

@@ -159,20 +159,20 @@ Keep in mind that these options are applied to the single DOM element you add sv
159159
| blur | `number` | `16` | The starting blur value in pixels (_px_) of the `"blur"` transition. |
160160
| scale | `number` | `0` | The starting scale value in percentage (_%_) of the `"scale"` transition. |
161161

162-
### 🪄&nbsp;&nbsp;Transitions
162+
### Transitions
163163

164164
The following are all the transitions available by svelte-reveal. The names listed in the table match the ones you can write in your source code. All transitions have the fade transition backed in.
165165

166-
| Name | Description |
167-
| ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
168-
| fade | The element fades in gracefully.<br />In practice: `opacity: 0 -> 1` |
169-
| fly | The element fades in and performs a translation on the y-axis (vertical).<br />In practice: `opacity: 0 -> 1` and `transform: translateY(-20px -> 0px) ` |
166+
| Name | Description |
167+
| ----- | ------------------------------------------------------------ |
168+
| fade | The element fades in gracefully.<br />In practice: `opacity: 0 -> 1` |
169+
| fly | The element fades in and performs a translation on the y-axis (vertical).<br />In practice: `opacity: 0 -> 1` and `transform: translateY(-20px -> 0px) ` |
170170
| slide | The element fades in and performs a translation on the x-axis (horizontal).<br />In practice: `opacity: 0 -> 1` and `transform: translateX(-20px -> 0px)` |
171-
| blur | The element fades in and becomes unblurred.<br />In practice: `opacity: 0 -> 1` and `filter: blur(8px -> 0px)` |
172-
| scale | The element fades in and gets to the original size.<br />In practice: `opacity: 0 -> 1` and `transform: scale(0 -> 1)` |
173-
| spin | The element fades in and gets to the original rotation degree.<br />In practice: `opacity: 0 -> 1` and `transform: rotate(-360 -> 0)` |
171+
| blur | The element fades in and becomes unblurred.<br />In practice: `opacity: 0 -> 1` and `filter: blur(8px -> 0px)` |
172+
| scale | The element fades in and gets to the original size.<br />In practice: `opacity: 0 -> 1` and `transform: scale(0 -> 1)`<br /><br />⚠️ In order to use this transition it is required to use the `width` CSS property on the element to reveal. If you are not already using this property for other things, you can set it to `width: fit-content` . |
173+
| spin | The element fades in and gets to the original rotation degree.<br />In practice: `opacity: 0 -> 1` and `transform: rotate(-360 -> 0)`<br /><br />⚠️ In order to use this transition it is required to use the `width` CSS property on the element to reveal. If you are not already using this property for other things, you can use set it to `width: fit-content` . |
174174

175-
### 🤙🏻&nbsp;&nbsp;Callbacks
175+
### Callbacks
176176

177177
Among the available options you can set, there are also some callback functions you can leverage to inject some code during specific moments of the lifecycle of the nodes attached to this action.
178178

@@ -186,7 +186,7 @@ Among the available options you can set, there are also some callback functions
186186
| onUpdate | `(node: HTMLElement)` | `void` | Function that gets fired when the action options are updated. |
187187
| onDestroy | `(node: HTMLElement)` | `void` | Function that gets fired when the node is unmounted from the DOM. |
188188

189-
## 📄&nbsp;&nbsp;Global config
189+
## Global config
190190

191191
This library is globally configured as follows right of out the box:
192192

@@ -212,7 +212,7 @@ This library is globally configured as follows right of out the box:
212212
| | rootMargin | | `string` | `"0px 0px 0px 0px"` | The Intersection Observer API rootMargin property. |
213213
| | threshold | | `number` | `0.6` | The Intersection Observer API threshold property. |
214214

215-
## ⚡️&nbsp;&nbsp;API
215+
## API
216216

217217
> 💡&nbsp;&nbsp;All API functions return the global config object with the updated properties.
218218
@@ -353,30 +353,30 @@ interface IOptions {
353353
| --------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
354354
| `(options: IOptions)` | `IOptions` | You can use this function to override the global default options of the reveal effect. It can be useful when you want a specific option for many elements, so that you don't have to change it for every element individually. |
355355

356-
## 👀&nbsp;&nbsp;Suggestions
356+
## Suggestions
357357

358358
In order to take full advantage of this library, I suggest you to create some environment variables to keep track of the environment you are currently in (e.g. development, staging, production) and to leverage NPM scripts to update those variables. [This article](https://www.twilio.com/blog/working-with-environment-variables-in-node-js-html) explains well this concept.
359359

360360
That way you can for example set the config `dev` property to `false` when in production and avoid exposing console logs to the end users.
361361

362362
If you use [SvelteKit](https://kit.svelte.dev/), this feature is available right out of the box with the [$app/env](https://kit.svelte.dev/docs#modules-$app-env) module.
363363

364-
## 🤕&nbsp;&nbsp;Troubleshooting
364+
## Troubleshooting
365365

366366
Feel free to [open a new issue](https://github.com/DaveKeehl/svelte-reveal/issues/new/choose) in case of any problems.
367367

368-
## ☕️&nbsp;&nbsp;Funding
368+
## Funding
369369

370370
[Want to buy me a coffee?](https://ko-fi.com/davekeehl)
371371

372-
## 📚&nbsp;&nbsp;Versioning
372+
## Versioning
373373

374374
This project uses [Semantic Versioning](https://semver.org/) to keep track of its version number.
375375

376-
## ✍🏻&nbsp;&nbsp;Changelog
376+
## Changelog
377377

378378
[CHANGELOG](https://github.com/DaveKeehl/svelte-reveal/blob/develop/CHANGELOG.md)
379379

380-
## 👨🏻‍⚖️&nbsp;&nbsp;License
380+
## License
381381

382382
[MIT](https://github.com/DaveKeehl/svelte-reveal/blob/develop/LICENSE)

assets/readme_cover.png

68 Bytes
Loading

0 commit comments

Comments
 (0)