reveal.js-appearance 1.3.4 → 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,17 @@ 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:
66
68
 
67
69
  ```html
68
70
  <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';
71
+ import Reveal from 'reveal.js';
72
+ import Appearance from 'reveal.js-appearance';
73
+ import 'reveal.js-appearance/plugin/appearance/appearance.css';
72
74
  Reveal.initialize({
73
75
  // ...
74
76
  plugins: [ Appearance ]
@@ -76,19 +78,43 @@ If you're using ES modules, you can add it like this:
76
78
  </script>
77
79
  ```
78
80
 
79
- ### Styling
80
- The styling of Appearance is automatically inserted **when the appearance folder is manually (or automatically) copied** to the Reveal.js plugin folder.
81
-
82
- **BUT**: If you are using a bundler like Webpack or Parcel, that uses **import**, you will also need to **import** the CSS file yourself. Depending on your setup this can be something like this:
81
+ Otherwise, you may want to copy the plugin into a plugin folder or an other location::
83
82
 
83
+ ```html
84
+ <script type="module">
85
+ import Reveal from './dist/reveal.mjs';
86
+ import Appearance from './plugin/appearance/appearance.mjs';
87
+ import './plugin/appearance/appearance.css';
88
+ Reveal.initialize({
89
+ // ...
90
+ plugins: [ Appearance ]
91
+ });
92
+ </script>
84
93
  ```
94
+
95
+
96
+ ### Styling
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
85
101
  import 'reveal.js-appearance/plugin/appearance/appearance.css';
86
102
  ```
87
103
 
88
- In that case, the `cssautoload` option (in the Reveal appearance options) should be set to `false`, to avoid style loading errors.
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.
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.
89
107
 
90
- > However, if you actually know the correct full path to the CSS file, then you can still use the `csspath` option and keep `cssautoload` set to `true`.
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:
91
110
 
111
+ ```css
112
+ :root {
113
+ --cssimported-appearance: true;
114
+ }
115
+ ```
116
+
117
+ ## Setup
92
118
 
93
119
  ### HTML
94
120
 
@@ -96,9 +122,9 @@ It is easy to set up your HTML structure for Appearance. Each element that you w
96
122
 
97
123
  ```html
98
124
  <ul>
99
- <li class="animate__bounceInLeft">Add it to any text element</li>
100
- <li class="animate__bounceInLeft">Like list items, or headers.</li>
101
- <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>
102
128
  </ul>
103
129
  ```
104
130
 
@@ -109,8 +135,8 @@ When you are working with Markdown (or in any other case), this can be a chore *
109
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:
110
136
 
111
137
  ```html
112
- <h3 class="animate__fadeInDown" data-split="words">Let words apear and appear</h3>
113
- <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>
114
140
  ```
115
141
 
116
142
 
@@ -152,7 +178,7 @@ Also note the (optional) `baseline` class here, which makes the words appear fro
152
178
  <h3 class="animate__fadeInUp animate__faster baseline"
153
179
  data-split="words"
154
180
  data-delay="80"
155
- data-container-delay="600">Let words apear and appear</h3>
181
+ data-container-delay="600">Let words appear word by word</h3>
156
182
  ```
157
183
 
158
184
 
@@ -167,11 +193,11 @@ There are cases however, where there is hardly any transition, for example, when
167
193
 
168
194
  ```html
169
195
  <section data-appearevent="auto">
170
- <ul>
171
- <li class="animate__fadeInLeft">This is list item 1</li>
172
- <li class="animate__fadeInLeft">This is list item 2</li>
173
- <li class="animate__fadeInLeft">This is list item 1</li>
174
- </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>
175
201
  </section>
176
202
  ```
177
203
 
@@ -180,6 +206,18 @@ These same event triggers can be set through the `appearevent` option in the glo
180
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.
181
207
 
182
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
+
183
221
  ## Autoappear
184
222
 
185
223
  You can simplify the addition of animation classes.
@@ -207,19 +245,20 @@ Reveal.initialize({
207
245
 
208
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:
209
247
 
210
- * animation
211
- * speed
212
- * delay
213
- * split
214
- * 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
215
254
 
216
- where the last two keys are specific for word- and letter-animations.
255
+ where the last key is specific for word- and letter-animations.
217
256
 
218
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:
219
258
 
220
259
  ```html
221
260
  <ul>
222
- <li>Add it to any text element</li>
261
+ <li>Add it to any text element</li>
223
262
  <li>Like list items, or headers.</li>
224
263
  <li>It adds some attention.</li>
225
264
  </ul>
@@ -259,7 +298,7 @@ Reveal.initialize({
259
298
  <ul>
260
299
  <li>This is list item 1</li>
261
300
  <li>This is list item 2</li>
262
- </ul>
301
+ </ul>
263
302
  </section>
264
303
  ```
265
304
 
@@ -281,80 +320,63 @@ In the example below you can see that mixing strings and objects is perfectly fi
281
320
  </section>
282
321
  ```
283
322
 
284
- ## Configuration
323
+ ### Container-aware delays
285
324
 
286
- 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.
287
344
 
288
345
  ```javascript
289
346
  Reveal.initialize({
290
347
  // ...
291
348
  appearance: {
292
- hideagain: true,
293
- delay: 300,
294
- appearevent: 'slidetransitionend',
295
- autoappear: false,
296
- autoelements: false,
297
- cssautoload: true,
298
- csspath: '',
299
- animatecsspath: {
300
- link : 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
301
- compat : 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.compat.css',
302
- },
303
- compatibility: false,
304
- 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
305
357
  },
306
358
  plugins: [ Appearance ]
307
359
  });
308
360
  ```
309
361
 
310
- * **`hideagain`**: Change this (true/false) if you want to see the shown elements if you go back.
311
- * **`delay`**: Base time in ms between appearances.
312
- * **`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'`.
313
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.
314
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.
315
- * **`cssautoload`**: Appearance will load the 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 csspath 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`.
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`.
316
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.
317
- * **`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.
318
- * **`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.
319
- * **`compatibilitybaseclass`**: This is the baseclass to use if you don't change your markup.
320
-
321
-
322
-
323
-
324
- ## Migration guide
325
- 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.
326
-
327
- You have two options to migrate to the new version:
328
-
329
- ### Adjust your markup
330
-
331
- If in Appearance v1.1.1 you used this:
332
-
333
- ```html
334
- <img class="animated fadeInDown" data-src="1.jpg">
335
- ```
336
-
337
- you should now use this:
338
-
339
- ```html
340
- <img class="animate__fadeInDown" data-src="1.jpg">
341
- ```
342
- which is the only change in the markup.
343
-
344
-
345
- ### Turn on compatibility mode
346
-
347
- 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.
348
370
 
349
371
 
350
372
 
351
373
  ## Like it?
352
374
  If you like it, please star this repo!
353
375
 
354
- 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:
355
377
 
356
378
 
357
379
  ## License
358
380
  MIT licensed
359
381
 
360
- Copyright (C) 2023 Martijn De Jongh (Martino)
382
+ Copyright (C) 2026 Martijn De Jongh (Martino)
package/package.json CHANGED
@@ -1,63 +1,74 @@
1
1
  {
2
- "name": "reveal.js-appearance",
3
- "version": "1.3.4",
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
- "ws": "8.17.1"
36
- },
37
- "browserslist": "> 2%, not dead",
38
- "devDependencies": {
39
- "@babel/preset-env": "^7.23.2",
40
- "@rollup/plugin-babel": "^6.0.4",
41
- "@rollup/plugin-commonjs": "^25.0.7",
42
- "@rollup/plugin-node-resolve": "^15.2.3",
43
- "@rollup/plugin-terser": "^0.4.4",
44
- "browser-sync": "^3.0.2",
45
- "del": "^5.1.0",
46
- "gulp": "^5.0.0",
47
- "gulp-autoprefixer": "^8.0.0",
48
- "gulp-plumber": "^1.2.1",
49
- "gulp-pug": "^5.0.0",
50
- "gulp-rename": "^2.0.0",
51
- "gulp-sass": "^5.1.0",
52
- "gulp-tap": "^2.0.0",
53
- "merge-stream": "^2.0.0",
54
- "rollup": "^4.2.0",
55
- "sass": "^1.63.6"
56
- },
57
- "dependencies": {
58
- "reveal.js": "^5.0.4"
59
- },
60
- "copydependencies": [
61
- "reveal.js"
62
- ]
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
+ }
63
74
  }