reveal.js-appearance 1.3.3 → 1.4.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Martijn De Jongh (Martino)
3
+ Copyright (c) 2026 Martijn De Jongh (Martino)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -13,8 +13,6 @@ In Powerpoint you can make slides with items that appear automatically with effe
13
13
 
14
14
  The animations will start automatically after or at each slide or fragment change if the HTML is set up to use Appearance.
15
15
 
16
- Version 1.3.0 adds an option to animate the words in a sentence, or the letters in a word.
17
-
18
16
 
19
17
  ## Basics
20
18
 
@@ -42,10 +40,11 @@ The Appearance plugin folder can then be referenced from `node_modules/reveal.js
42
40
 
43
41
 
44
42
 
45
- ## Setup
43
+ ## Adding Appearance to your presentation
46
44
 
47
45
  ### JavaScript
48
46
 
47
+
49
48
  There are two JavaScript files for Appearance, a regular one, `appearance.js`, and a module one, `appearance.esm.js`. You only need one of them:
50
49
 
51
50
  #### Regular
@@ -61,14 +60,31 @@ If you're not using ES modules, for example, to be able to run your presentation
61
60
  });
62
61
  </script>
63
62
  ```
64
- #### As a module
65
- If you're using ES modules, you can add it like this:
63
+
64
+
65
+ #### From npm
66
+
67
+ You can run it directly from npm:
68
+
69
+ ```html
70
+ <script type="module">
71
+ import Reveal from 'reveal.js';
72
+ import Appearance from 'reveal.js-appearance';
73
+ import 'reveal.js-appearance/plugin/appearance/appearance.css';
74
+ Reveal.initialize({
75
+ // ...
76
+ plugins: [ Appearance ]
77
+ });
78
+ </script>
79
+ ```
80
+
81
+ Otherwise, you may want to copy the plugin into a plugin folder or an other location::
66
82
 
67
83
  ```html
68
84
  <script type="module">
69
- // This will need a server
70
- import Reveal from './dist/reveal.esm.js';
71
- import Appearance from './plugin/appearance/appearance.esm.js';
85
+ import Reveal from './dist/reveal.mjs';
86
+ import Appearance from './plugin/appearance/appearance.mjs';
87
+ import './plugin/appearance/appearance.css';
72
88
  Reveal.initialize({
73
89
  // ...
74
90
  plugins: [ Appearance ]
@@ -76,12 +92,29 @@ If you're using ES modules, you can add it like this:
76
92
  </script>
77
93
  ```
78
94
 
95
+
79
96
  ### Styling
80
- The styling of Appearance is automatically inserted, either loaded through NPM or from the plugin folder. Two files are inserted: The first one is Animate.css by Daniel Eden for the basic animations, we add it through a CDN. The second file adds to the first stylesheet to allow for a non-animated state.
97
+ The styling of Appearance is automatically inserted **when the appearance folder is manually copied** to the Reveal.js plugin folder.
98
+
99
+ If you **import** reveal.js-appearance from npm, you will need to **import** the CSS file yourself. Depending on your setup this can be something like this:
100
+ ```javascript
101
+ import 'reveal.js-appearance/plugin/appearance/appearance.css';
102
+ ```
81
103
 
82
- If you want to change the Appearance style, you can simply make your own style and use that stylesheet instead. Linking to your custom styles can be managed through the `csspath` option of Appearance.
104
+ Appearance will detect if it runs in a module environment and will then not autoload the CSS. You can still set `cssautoload` to `true` if you like, but your bundler (Vite, Webpack) may not like that. In any of these cases, `import` the CSS file yourself.
83
105
 
106
+ If you want to change the Appearance style, you can do a lot of that via the Reveal.js options. Or you can simply make your own style and use that stylesheet instead. Linking to your custom styles can be managed through the `csspath` option of Appearance or through `import` when using modules.
84
107
 
108
+ #### Custom CSS
109
+ If and when you decide to create your own CSS file, make sure that you also include the following CSS variable, that is used by the plugin to avoid loading the CSS multiple times, and to avoid using the autoloading feature when using modules:
110
+
111
+ ```css
112
+ :root {
113
+ --cssimported-appearance: true;
114
+ }
115
+ ```
116
+
117
+ ## Setup
85
118
 
86
119
  ### HTML
87
120
 
@@ -89,9 +122,9 @@ It is easy to set up your HTML structure for Appearance. Each element that you w
89
122
 
90
123
  ```html
91
124
  <ul>
92
- <li class="animate__bounceInLeft">Add it to any text element</li>
93
- <li class="animate__bounceInLeft">Like list items, or headers.</li>
94
- <li class="animate__bounceInLeft">It adds some attention.</li>
125
+ <li class="animate__bounceInLeft">Add it to any text element</li>
126
+ <li class="animate__bounceInLeft">Like list items, or headers.</li>
127
+ <li class="animate__bounceInLeft">It adds some attention.</li>
95
128
  </ul>
96
129
  ```
97
130
 
@@ -102,8 +135,8 @@ When you are working with Markdown (or in any other case), this can be a chore *
102
135
  To nicely animate the words in a heading, or the letters of a word, add an animation class to it, and add a data-attribute for the kind of split you want:
103
136
 
104
137
  ```html
105
- <h3 class="animate__fadeInDown" data-split="words">Let words apear and appear</h3>
106
- <h3 class="animate__fadeInDown" data-split="letters">Let letters apear and appear</h3>
138
+ <h3 class="animate__fadeInDown" data-split="words">Let words appear word by word</h3>
139
+ <h3 class="animate__fadeInDown" data-split="letters">Let letters appear letter by letter</h3>
107
140
  ```
108
141
 
109
142
 
@@ -137,20 +170,22 @@ You can change the speed of each animation, using the tempo classes from Animate
137
170
 
138
171
  For words and letters, the same techniques can be used.
139
172
 
140
- Note that the data-delay also gets copied to the smaller elements in it, which means that there is no more 'whole sentence' or 'whole word' to delay. By default, the whole element then gets the delay (depending on if it is following other animations) as defined in the `delay` option in the Configuration, but it can be overriden by an optional `data-container-delay`.
173
+ Note that the data-delay also gets copied to the smaller elements in it, which means that there is no more 'whole sentence' or 'whole word' to delay. By default, the whole element then gets the delay (depending on if it is following other animations) as defined in the `delay` option in the Configuration, but it can be overriden by an optional `data-container-delay`.
174
+
175
+ Also note the (optional) `baseline` class here, which makes the words appear from the baseline of the text.
141
176
 
142
177
  ```html
143
- <h3 class="animate__fadeInDown animate__faster"
178
+ <h3 class="animate__fadeInUp animate__faster baseline"
144
179
  data-split="words"
145
180
  data-delay="80"
146
- data-container-delay="600">Let words apear and appear</h3>
181
+ data-container-delay="600">Let words appear word by word</h3>
147
182
  ```
148
183
 
149
184
 
150
185
  ### Changing the 'appearevent'
151
186
  When you navigate from slide to slide, you can set transition effects in Reveal. These effects take some time. That's why, by default, Appearance only starts when the slide transition has ended.
152
187
 
153
- There are cases however, where there is hardly any transition, for example, when going from an autoanimate slide to another. Reveal then suppresses the user-set transition to a short opacity change. Starting *together with* the transition might then be nicer. You can use any of the following events:
188
+ There are cases however, where there is hardly any transition, for example, when going from an autoanimate slide to another. Reveal then suppresses the user-set transition to a short opacity change. Starting *together with* the transition might then be nicer. You can use any of the following events:
154
189
 
155
190
  * *slidetransitionend* (default, Appearance will always start animating elements after the transition)
156
191
  * *slidechanged* (Appearance will always start together with the transition)
@@ -158,11 +193,11 @@ There are cases however, where there is hardly any transition, for example, whe
158
193
 
159
194
  ```html
160
195
  <section data-appearevent="auto">
161
- <ul>
162
- <li class="animate__fadeInLeft">This is list item 1</li>
163
- <li class="animate__fadeInLeft">This is list item 2</li>
164
- <li class="animate__fadeInLeft">This is list item 1</li>
165
- </ul>
196
+ <ul>
197
+ <li class="animate__fadeInLeft">This is list item 1</li>
198
+ <li class="animate__fadeInLeft">This is list item 2</li>
199
+ <li class="animate__fadeInLeft">This is list item 1</li>
200
+ </ul>
166
201
  </section>
167
202
  ```
168
203
 
@@ -171,6 +206,18 @@ These same event triggers can be set through the `appearevent` option in the glo
171
206
  When using Appearance inside an autoanimate slide, and changing the appearevent to `slidechanged` or `auto`, keep in mind that Reveal transforms opacity for all non-autoanimate items, while Appearance does the same on most of the effects. To avoid strange behaviour, wrap these Appearance items in a parent. For example, a list of animated bullet points works well, because the animated class is on the children, not the parent. Separate headings or other elements do not have that, so should be wrapped.
172
207
 
173
208
 
209
+ ### Initial delay on page load
210
+ You can set a delay before animations start, but only on the initial page load or reloads (not when navigating between slides):
211
+
212
+ <section data-init-delay="2000">
213
+ <h3>Welcome</h3>
214
+ <p class="animate__fadeIn">This will appear 2 seconds after page load</p>
215
+ </section>
216
+ ```
217
+
218
+
219
+
220
+
174
221
  ## Autoappear
175
222
 
176
223
  You can simplify the addition of animation classes.
@@ -198,19 +245,20 @@ Reveal.initialize({
198
245
 
199
246
  You can add any selector and animation class to this object. You can use a simple JSON object, or more elaborate like this (you can also mix them): `{"ul li": {"animation":"animate__fadeInLeft", "speed":"slow", "delay":"100"}}`. An object like that can contain the following keys:
200
247
 
201
- * animation
202
- * speed
203
- * delay
204
- * split
205
- * container-delay
248
+ * **animation**: The Animate.css animation class
249
+ * **speed**: Animation speed (slower, slow, fast, faster)
250
+ * **delay**: Delay between elements in milliseconds
251
+ * **initial-delay**: Delay before the first element of this type appears in milliseconds
252
+ * * **container-delay**: Delay before the first element in each container (when elements are in separate parent containers)
253
+ * **split**: Split text into words (`data-split="words"`) or letters (`data-split="letters"`) for individual animation
206
254
 
207
- where the last two keys are specific for word- and letter-animations.
255
+ where the last key is specific for word- and letter-animations.
208
256
 
209
257
  If you choose to write all your animation selectors and properties globally, you no longer need to add any classes to the markup and it can stay like this:
210
258
 
211
259
  ```html
212
260
  <ul>
213
- <li>Add it to any text element</li>
261
+ <li>Add it to any text element</li>
214
262
  <li>Like list items, or headers.</li>
215
263
  <li>It adds some attention.</li>
216
264
  </ul>
@@ -250,7 +298,7 @@ Reveal.initialize({
250
298
  <ul>
251
299
  <li>This is list item 1</li>
252
300
  <li>This is list item 2</li>
253
- </ul>
301
+ </ul>
254
302
  </section>
255
303
  ```
256
304
 
@@ -272,78 +320,63 @@ In the example below you can see that mixing strings and objects is perfectly fi
272
320
  </section>
273
321
  ```
274
322
 
275
- ## Configuration
323
+ ### Container-aware delays
276
324
 
277
- There are a few options that you can change from the Reveal.js options. The values below are default and do not need to be set if they are not changed.
325
+ When you have multiple groups of elements in separate containers, `container-delay` applies to the first element in each container, while `delay` applies between elements within the same container. In the example below, the `delay` is the standard 300ms from the global options.
326
+
327
+ ```html
328
+ <section data-autoappear='{"img.test": {"animation":"animate__fadeInDown", "container-delay":"1200"}}'>
329
+ <h3>Container-aware delays</h3>
330
+ <div class="row">
331
+ <img class="test" src="assets/img/1.jpg">
332
+ ... other images ...
333
+ </div>
334
+ </section>
335
+ ```
336
+
337
+
338
+
339
+
340
+
341
+ ## Global options
342
+
343
+ There are a few options that you can change from the Reveal.js options. The values below, in alphabetical order, are default and do not need to be set if they are not changed. Some of the options have been removed, compared to the previous version. This is mainly because we now auto-import Animate.css, so no need to set that up anymore.
278
344
 
279
345
  ```javascript
280
346
  Reveal.initialize({
281
347
  // ...
282
348
  appearance: {
283
- hideagain: true,
284
- delay: 300,
285
- appearevent: 'slidetransitionend',
286
- autoappear: false,
287
- autoelements: false,
288
- csspath: '',
289
- animatecsspath: {
290
- link : 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
291
- compat : 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.compat.css',
292
- },
293
- compatibility: false,
294
- compatibilitybaseclass: 'animated'
349
+ appearevent: 'slidetransitionend',
350
+ autoappear: false,
351
+ autoelements: false,
352
+ cssautoload: true,
353
+ csspath: '',
354
+ delay: 300,
355
+ hideagain: true,
356
+ initdelay: 0
295
357
  },
296
358
  plugins: [ Appearance ]
297
359
  });
298
360
  ```
299
361
 
300
- * **`hideagain`**: Change this (true/false) if you want to see the shown elements if you go back.
301
- * **`delay`**: Base time in ms between appearances.
302
- * **`appearevent`**: Use a specific event at which Appearance starts.
362
+ * **`appearevent`**: Use a specific event at which Appearance starts. Options: `'slidetransitionend'` (default), `'slidechanged'`, or `'auto'`.
303
363
  * **`autoappear`**: Use this when you do not want to add classes to each item that you want to appear, and just let Appearance add animation classes to (all of) the provided elements in the presentation. See "Autoappear" mode above.
304
364
  * **`autoelements`**: These are the elements that `autoappear` will target. Each element has a selector and an animation class. If `autoappear` is off, the elements will still get animation if the section contains a `data-autoappear` attribute.
365
+ * **`cssautoload`**: Appearance will load the CSS (including Animate.css) if this is set to `true`. If you import reveal.js-appearance from npm, you will need to import the CSS file yourself. If you use 'import', then `cssautoload` should be set to `false`. If you know the path to the CSS file, you can use the `csspath` option and keep `cssautoload` set to `true`.
305
366
  * **`csspath`**: Appearance will automatically load the styling of the plugin. If you want to customise the styling, you can link to your own CSS file here.
306
- * **`animatecsspath`**: Appearance will also automatically load the styling of Animate.css via a CDN. Note that Animate.css has two links, the first (CDN) one is for version 4, the second (old) one is the version 3 compatibility CDN link.
307
- * **`compatibility`**: This setting can let you use your current markup. However, because this also uses the Animate.css compatibility CSS, and it is likely that they will not support this in the future, please update your markup as shown above.
308
- * **`compatibilitybaseclass`**: This is the baseclass to use if you don't change your markup.
309
-
310
-
311
-
312
-
313
- ## Migration guide
314
- Appearance v1.1.2 was an update to stay current with the latest version of Animate.css, which itself brought breaking changes in version 4. Animate.css v4 added a prefix for all of the Animate.css classes, defaulting to `animate__` . Appearance will now automatically add the Animate.css base class (`animate__animated`) to any element with a Animate.css animation class.
315
-
316
- You have two options to migrate to the new version:
317
-
318
- ### Adjust your markup
319
-
320
- If in Appearance v1.1.1 you used this:
321
-
322
- ```html
323
- <img class="animated fadeInDown" data-src="1.jpg">
324
- ```
325
-
326
- you should now use this:
327
-
328
- ```html
329
- <img class="animate__fadeInDown" data-src="1.jpg">
330
- ```
331
- which is the only change in the markup.
332
-
333
-
334
- ### Turn on compatibility mode
335
-
336
- If you turn in compatibility mode in Appearance, you can keep using your current markup. However, because this also uses the Animate.css compatibility CSS, this might break your presentations in the future, so it is not recommended. See the options above for compatibility mode and the compatibility base class.
367
+ * **`delay`**: Base time in milliseconds between element appearances. This is the delay between items of the same type.
368
+ * **`hideagain`**: Change this (true/false) if you want to see the shown elements if you go back. When set to `true`, elements will hide again when navigating away from the slide.
369
+ * **`initdelay`**: Sets a delay in milliseconds before any animations start, but only on the initial page load (not when navigating between slides). Default is `0` (no delay). Can be overridden per-slide with `data-init-delay` attribute.
337
370
 
338
371
 
339
372
 
340
373
  ## Like it?
341
374
  If you like it, please star this repo!
342
375
 
343
- And if you want to show off what you made with it, please do :-)
376
+ And if you want to show off what you made with it, please do :smiley:
344
377
 
345
378
 
346
379
  ## License
347
380
  MIT licensed
348
381
 
349
- Copyright (C) 2023 Martijn De Jongh (Martino)
382
+ Copyright (C) 2026 Martijn De Jongh (Martino)
package/package.json CHANGED
@@ -1,65 +1,74 @@
1
1
  {
2
- "name": "reveal.js-appearance",
3
- "version": "1.3.3",
4
- "description": "An animation plugin for Reveal.js that animates elements sequentially like in Powerpoint. Perfect for online portfolios or other presentations with images.",
5
- "keywords": [
6
- "reveal",
7
- "reveal.js",
8
- "reveal-plugin",
9
- "plugin",
10
- "text effects",
11
- "powerpoint"
12
- ],
13
- "main": "plugin/appearance/appearance.js",
14
- "module": "plugin/appearance/appearance.esm.js",
15
- "browser": "plugin/appearance/appearance.js",
16
- "author": {
17
- "name": "Martijn De Jongh (Martino)",
18
- "email": "martijn.de.jongh@gmail.com",
19
- "web": "https://martinomagnifico.github.io",
20
- "url": "https://martinomagnifico.github.io",
21
- "username": "martinomagnifico"
22
- },
23
- "homepage": "https://github.com/Martinomagnifico/reveal.js-appearance",
24
- "repository": {
25
- "type": "git",
26
- "url": "git://github.com/martinomagnifico/reveal.js-appearance.git"
27
- },
28
- "functionname": "Appearance",
29
- "license": "MIT",
30
- "scripts": {
31
- "start": "gulp demo",
32
- "build": "NODE_ENV=prod gulp build"
33
- },
34
- "overrides": {
35
- "chokidar": "3.5.3",
36
- "glob-parent": "6.0.2",
37
- "axios": "1.6.1"
38
- },
39
- "browserslist": "> 2%, not dead",
40
- "devDependencies": {
41
- "@babel/preset-env": "^7.23.2",
42
- "@rollup/plugin-babel": "^6.0.4",
43
- "@rollup/plugin-commonjs": "^25.0.7",
44
- "@rollup/plugin-node-resolve": "^15.2.3",
45
- "@rollup/plugin-terser": "^0.4.4",
46
- "browser-sync": "^2.29.3",
47
- "del": "^5.1.0",
48
- "gulp": "^4.0.2",
49
- "gulp-autoprefixer": "^8.0.0",
50
- "gulp-header": "^2.0.9",
51
- "gulp-plumber": "^1.2.1",
52
- "gulp-pug": "^5.0.0",
53
- "gulp-rename": "^2.0.0",
54
- "gulp-sass": "^5.1.0",
55
- "merge-stream": "^2.0.0",
56
- "rollup": "^4.2.0",
57
- "sass": "^1.63.6"
58
- },
59
- "dependencies": {
60
- "reveal.js": "^5.0.1"
61
- },
62
- "copydependencies": [
63
- "reveal.js"
64
- ]
2
+ "name": "reveal.js-appearance",
3
+ "version": "1.4.0",
4
+ "description": "An animation plugin for Reveal.js that animates elements sequentially like in Powerpoint. Perfect for online portfolios or other presentations with images.",
5
+ "keywords": [
6
+ "reveal",
7
+ "reveal.js",
8
+ "reveal-plugin",
9
+ "plugin",
10
+ "text effects",
11
+ "powerpoint"
12
+ ],
13
+ "homepage": "https://github.com/martinomagnifico/reveal.js-appearance",
14
+ "license": "MIT",
15
+ "author": {
16
+ "name": "Martijn De Jongh (Martino)",
17
+ "email": "martijn.de.jongh@gmail.com",
18
+ "web": "https://martinomagnifico.github.io",
19
+ "url": "https://martinomagnifico.github.io",
20
+ "username": "martinomagnifico"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git://github.com/martinomagnifico/reveal.js-appearance.git"
25
+ },
26
+ "type": "module",
27
+ "main": "./plugin/appearance/appearance.js",
28
+ "module": "./plugin/appearance/appearance.mjs",
29
+ "exports": {
30
+ ".": {
31
+ "import": "./plugin/appearance/appearance.mjs",
32
+ "require": "./plugin/appearance/appearance.js"
33
+ },
34
+ "./plugin/appearance/appearance.esm.js": "./plugin/appearance/appearance.mjs",
35
+ "./plugin/appearance/appearance.css": "./plugin/appearance/appearance.css",
36
+ "./appearance.css": "./plugin/appearance/appearance.css"
37
+ },
38
+ "style": "plugin/appearance/appearance.css",
39
+ "files": [
40
+ "plugin/appearance"
41
+ ],
42
+ "scripts": {
43
+ "start": "npm run dev",
44
+ "copy-reveal": "node scripts/copy-reveal.mjs",
45
+ "copy-plugin": "node scripts/copy-plugin.mjs",
46
+ "dev": "vite",
47
+ "prebuild": "rimraf demo plugin",
48
+ "build-plugin": "vite build -c vite.lib.config.ts",
49
+ "build-demo": "vite build -c vite.config.ts",
50
+ "build": "npm run build-plugin && npm run build-demo && npm run copy-reveal && npm run copy-plugin",
51
+ "format": "biome format --write .",
52
+ "lint": "biome lint .",
53
+ "check": "biome check --write .",
54
+ "preview": "npm run build && vite preview",
55
+ "ci": "biome ci ."
56
+ },
57
+ "devDependencies": {
58
+ "@biomejs/biome": "2.3.11",
59
+ "@types/node": "^22.10.1",
60
+ "@types/reveal.js": "^5.0.4",
61
+ "@vituum/vite-plugin-pug": "latest",
62
+ "animate.css": "^4.1.1",
63
+ "fs-extra": "latest",
64
+ "reveal.js-plugintoolkit": "1.0.2",
65
+ "rimraf": "^6.0.1",
66
+ "sass": "latest",
67
+ "typescript": "^5.7.2",
68
+ "vite": "latest",
69
+ "vituum": "1.2.0"
70
+ },
71
+ "peerDependencies": {
72
+ "reveal.js": ">=4.0.0"
73
+ }
65
74
  }